How To Alter This Code So That It Only Redirects If There Is No Mouse Movement

Posted by user1426261 on Stack Overflow See other posts from Stack Overflow or by user1426261
Published on 2012-05-30T22:37:42Z Indexed on 2012/05/30 22:41 UTC
Read the original article Hit count: 142

I have the following java script which redirects the user to another website (google in this case).

    <script type="text/JavaScript">
window.setTimeout("location=('http://www.google.com');",5000);
</script>

However, although i want the website to redirect to another website, i dont want it to redirect for no reason. My aim is for the website to redirect automatically on the condition that the cursor hasnt been moved for a little while.

is this possible?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about javascript-events