2

I am using the following code to prompt the user that if he left the page he can't come back. Things happened that i want to redirect the page using setTimeout function after a specific time. I want to disable checking for user leaving the page when the automatic redirection starts.

<script language="javascript" type="text/javascript"> needToConfirm = true; window.onbeforeunload = askConfirm; function askConfirm(){ if (needToConfirm){ return "Please note that you might not be able to come back and watch the movie again."; } } </script> 
1
  • 1
    The language attribute of the script element is deprecated. Commented Jun 13, 2010 at 12:58

1 Answer 1

0

Unset onbeforeunload in the function called by setTimeout before you redirect the user:

window.onbeforeunload = null; 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.