onunload issue



ggauthier
07-09-2005, 11:16 PM
I've got a winXP sp2 IE sp2 machine inhouse and several client machines that
don't fire the onunload event upon closing when the window was launched with
a window.open that supplied window properties(third parameter on the
window.open method) Below is a simple scenerio that fails on these machines.
The alert on the onunload doesn't show in those cases. If I remove the
third param of the window.open then it starts working. If I leave the param
as empty quotes '' it works fine. If I put anything, including an invalid
param value the onunload event it stops firing the onunload event.

Has ANYONE seen this before??? Below is the html to the simplified test
that fails on certain machines.

MainPage HTML

<html>
<body
onload="window.open('popup_test_onunload.html',null,'height=200,width=400,status=yes,toolbar=no,menubar=no,location=no');"></body>
</html>

popup_test_onunload.html HTML

<html>
<body onunload="alert('onunload worked');">
Close this window using the X button.
<br/>
You should see an "onunload worked" message.
</body>
</html>

ggauthier
07-09-2005, 11:17 PM
I found the issue. It's related to the Google bar popup blocker. When the
popup blocker is on for a site the onunload events are ignored. In our site
the user can launch popups from a button which the google bar doesn't block
therefore the user usually keeps the blocker on but it also means that all
onunload events are not respected. If I turn the popup blocker off then
everything is fine. The example above is not a good example because I launch
a popup from the onload event which would block the popup and force the user
to disable the popup blocker and enable the onunload event. If you use my
example, disable the popup blocker and then re-enable the blocker once the
popup is up. Then try and close the popup and notice that the onunload will
not fire.

"ggauthier" wrote:

> I've got a winXP sp2 IE sp2 machine inhouse and several client machines that
> don't fire the onunload event upon closing when the window was launched with
> a window.open that supplied window properties(third parameter on the
> window.open method) Below is a simple scenerio that fails on these machines.
> The alert on the onunload doesn't show in those cases. If I remove the
> third param of the window.open then it starts working. If I leave the param
> as empty quotes '' it works fine. If I put anything, including an invalid
> param value the onunload event it stops firing the onunload event.
>
> Has ANYONE seen this before??? Below is the html to the simplified test
> that fails on certain machines.
>
> MainPage HTML
>
> <html>
> <body
> onload="window.open('popup_test_onunload.html',null,'height=200,width=400,status=yes,toolbar=no,menubar=no,location=no');"></body>
> </html>
>
> popup_test_onunload.html HTML
>
> <html>
> <body onunload="alert('onunload worked');">
> Close this window using the X button.
> <br/>
> You should see an "onunload worked" message.
> </body>
> </html>
>
>
>
>


onunload issue