开发者

onbeforeunload load in javascript help

开发者 https://www.devze.com 2023-03-04 05:01 出处:网络
I have this code in javascript below: function ExitPage(){return \'Wait!\';} <body onbeforeunload=\"return ExitPage();\">

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

精彩评论

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