Reputation: 27
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';
}
Upvotes: 1
Views: 121
Reputation: 158
It seems you missed "()" while calling unloading function. Try this:
window.onbeforeunload = confirmExit();
window.onunload = unloading();
Upvotes: 1