window.onunload

window.onunload is not working properly in Chrome browser. Can any one help me?

荒凉一梦 提交于 2019-11-26 13:40:06
I have written this code function winUnload() { alert("Unload Window"); MyMethod(); } window.onunload = function() { winUnload(); } This code is working fine in IE and Firefox. But this code is not working in Chrome. Both the statements alert("Unload Window"); and MyMethod(); are not working. There are some actions which are not working in chrome, inside of the unload event. Alert or confirm boxes are such things. But what is possible (AFAIK): Open popups (with window.open) - but this will just work, if the popup blocker is disabled for your site Return a simple string (in beforeunload event),

window.onunload is not working properly in Chrome browser. Can any one help me?

試著忘記壹切 提交于 2019-11-26 05:54:22
问题 I have written this code function winUnload() { alert(\"Unload Window\"); MyMethod(); } window.onunload = function() { winUnload(); } This code is working fine in IE and Firefox. But this code is not working in Chrome. Both the statements alert(\"Unload Window\"); and MyMethod(); are not working. 回答1: There are some actions which are not working in chrome, inside of the unload event. Alert or confirm boxes are such things. But what is possible (AFAIK): Open popups (with window.open) - but