开发者

onbeforeunload load in javascript help

I have this code in javascript below:

function ExitPage(){return 'Wait!';}


<body onbeforeunload="return ExitPage();">

I would like to run some codes when the user clicks on the "cancel" button. How will I accomplish this?

Any suggestion would be g开发者_运维百科reatly appreciated.

Thanks


This is not possible. At least not in a safe way - the only think you could do is starting a timer in the onbeforeunload handler that runs for e.g. 10 seconds. If the page is still open after this time this timer then runs your code.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜