Click here to Skip to main content
14,667,837 members
Rate this:
Please Sign up or sign in to vote.
See more:
Hi guys,
I have written a function on onbeforeunload which uses setTimeout('myclose=false',100); - which should set the myclose variable as false afte 100ms interval.
But when I navigate to some other page from this page, it sometimes is not set as false and remains true - this behaviour is uncertain but usual one.
The strange thing is that when I put breakpoint in visula studio and just debug linebyline , it is set set to false always.
So i added sleep for 2000ms, afte settimeout call, but all in vain ...
So what can be the reason ?
- Ajay Kale

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

Should you not have the code as;

setTimeout( function () { myClose=false } , 100);

[Edit: oops, missed out the function()]
Dalek Dave 31-Aug-10 9:16am
Beat me to the correction! :)
DaveAuld 31-Aug-10 9:23am
DD, ha ha....[nelson style]

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100