In IE, there are several ways to define the onbeforeunload event handler
(1)<body onbeforeunload='confirmExit();'>
(2)document.body.onbeforeunload=confirmExit;
(3)window.onbeforeunload=confirmExit;
function confirmExit(){
return "You are about to leave this page. Are you sure?";
}
in FireFox, you can only use the (3) to trigger the unbeforeunload event handler. It frustrated me first, because I thought they are all same, but why I didn't get what I expected. I guess it is not supported very well and the first two approaches don't work in FireFox. So if you want to use onbeforeunload, please use the (3) to make it work on both IE and FireFox.
2 comments:
thanks 3 option works for me...
I every time emailed this blog post page to all my associates, since if like to read it after that my friends will too.
my webpage; illuminatural 6i reviews
Post a Comment