We expected that the handler attached to "window.onunload" gets invoked anytime when a document gets unloaded - means for any of following cases you should get same and consistent behavior. (A) Close last browser window (B) Close window, but still have another opened (C) Refresh window (D) Reload window/ put another URL in address bar Wrong behavior with Safari 3.1. (525.31.3) [WinXP/SP2] ------------------------------------------------------ Safari-for-Windows doesn't cover the case (A). When the LAST browser window is being closed, the handler attached to "window.onuload" is not called. Using attached sample, you will not get any alert or window opened for the case (A) at all. The cases (B,C,D) are handled properly. Expected behavior ----------------- MSIE, Firefox or even Safari for Mac 3.1 behaves correctly, in all cases (A,B,C,C) new window and popup gets displayed. Note: Even the scenario may look strange for you - we use the window.onuload to perform reasonable actions (to notify backend servers about to close backend sessions when the user left the browser), so it is not about just annoying popups/windows, but have strong real and valid usecase. I put the severity to Critical as it is almost a blocker for our apps. Can be related to: * http://bugs.webkit.org/show_bug.cgi?id=12469
Created attachment 20380 [details] Testcase for window.onunload bug Refresh, reload or close browser window and observe whether the browser is performing onunload actions or not. You should see a new new window and alert displayed.
As the testcase opens new window, make sure you disabled popup blocker before you start testing. (or comment out the "window.open" line completly, stay only with window.alert).
<rdar://problem/5846165>
See Bug 12469.
Seems to be fixed in TOT. Please let us know if it still doesn't work for you.