Trying to use onbeforeunload
then onunload
but the onunload
script does not seem to work.
window.onbeforeunload = confirmExit();
window.onunload = unloading();
function unloading() {
alert("testicles");
confirm("try");
}
function confirmExit(evt) {
return 'test1';
}
It seems you missed "()" while calling unloading function. Try this:
window.onbeforeunload = confirmExit();
window.onunload = unloading();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.