@Rod adapted code
$(function() {
timeout = setTimeout(function() {
window.location.href = "http://pt.stackoverflow.com";
}, 120000);
});
$(document).on('mousemove', function() {
if (timeout !== null) {
clearTimeout(timeout);
}
timeout = setTimeout(function() {
window.location.href = "http://pt.stackoverflow.com";
}, 120000);
});
In my example the redirect function was added and was removed from the function that caused the mouse to move over the is deleted from the page content.
A count in milliseconds that is equivalent to 2 minutes ( 120,000 milliseconds is equal to 120 seconds ), which is equal to 2 minutes , because 1 minute has 60 seconds ).
After 2 minutes you are redirected to link
Now you only need to edit it with the window.location.href
to which you want redirection to occur. In case:
window.location.href = "aguarde.php";
Now it's 100% functional , just the way you wanted it to be.
Fiddle Link
In the examples created in jsFiddle was given only 3,000 milliseconds = 3 seconds, so you do not have to wait 2 minutes to see the operation.