Bug 78331 - [test case] Cannot do window.open in onunload attribute.
Summary: [test case] Cannot do window.open in onunload attribute.
Status: RESOLVED UNMAINTAINED
Alias: None
Product: konqueror
Classification: Applications
Component: khtml ecma (show other bugs)
Version: 3.2.1
Platform: openSUSE Linux
: NOR normal
Target Milestone: ---
Assignee: Konqueror Developers
URL:
Keywords:
: 79441 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-03-23 23:00 UTC by Craig Altenburg
Modified: 2012-06-18 14:13 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Mondo test case (6.71 KB, text/html)
2005-06-29 14:33 UTC, Jesse Pelton
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Craig Altenburg 2004-03-23 23:00:52 UTC
Version:           3.2.1 (using KDE KDE 3.2.1)
Installed from:    SuSE RPMs
OS:          Linux

I am developing a web application that uses a popup window for navigation functions.  I want the user to be logged of, and a new logon form to be presented in the main window whenever the user closes this popup window.

I have added an "onUnload" attribute in the body of the page that displays in the popup:

<body onUnload     = "window.open( 'Logoff.jsp;jsessionid=0436152C58FAEB59F4BCE51EA87FA245', 'o_main' );" >

With Konqueror (and Safari 1.2.1) the Logoff.jsp does not get called when the window is closed.

This works fine in IE and Mozilla Firefox.
Comment 1 djoham 2004-03-23 23:02:51 UTC
Do you have pop-up blocking enabled? If it's anything other than off, both Safari and KHTML will probably block what you're doing thinking it is an ad...
Comment 2 Craig Altenburg 2004-03-24 02:24:35 UTC
No, popups are enabled.  In fact, the window with the offending "onUnload" is itself a popup window.  If there was something preventing popup in general I would not think that window would have been opened.
Comment 3 Sashmit Bhaduri 2004-03-28 18:22:27 UTC
Can you attach a small testcase?
Comment 4 Craig Altenburg 2004-03-29 21:49:52 UTC
Test Case:

Open     http://homepage.mac.com/qeygh/onunload.html

When you close the window you should get another window that tells you the first one closed.
(At least that's how IE and Firefox work.)
Comment 5 Sashmit Bhaduri 2004-04-01 00:40:00 UTC
Yes, indeed buggy
Comment 6 John Tapsell 2004-04-14 13:16:42 UTC
*** Bug 79441 has been marked as a duplicate of this bug. ***
Comment 7 Jesse Pelton 2005-06-29 14:33:34 UTC
Created attachment 11623 [details]
Mondo test case

Konqueror is not alone in handling unload events unevenly.  This test case uses
multiple approaches to setting an unload event handler on window and body
objects.  I tested with IE 6, Firefox 1.0.4, Opera 8.0, Konqueror 3.4, and
Safari 2.0.  Only Opera supported all the tested methods, but it invokes body
unload handlers multiple times.  Unfortunately, there is no single method that
works for all browsers.  I think that the ideal would be for all browsers to
support all the tested methods so script authors don't have to work out which
method works where, so I'll send this test case to the developers of all the
browsers I tested.
Comment 8 Luke-Jr 2008-02-25 14:21:15 UTC
So is there any way to inform my webapp that the user has closed the page? Right now I'm forced to timeout, but if I set the timeout too low it will kill off connections that are just slow.
Comment 9 Gérard Talbot (no longer involved) 2009-10-12 22:31:59 UTC
> I am developing a web application that uses a popup window for navigation functions.

With a majority of browsers handling tab nowadays, chances are such popup window is diverted into another tab.

http://homepage.mac.com/qeygh/onunload.html

> When you close the window you should get another window 
> that tells you the first one closed.
> (At least that's how IE and Firefox work.)

By default, Firefox (version 3.5.3 rv:1.9.1.3 build 20090824) has the 
property 
dom.popup_allowed_events
set to
change click dblclick mouseup reset submit

Unload is not listed. And people are not enclined to explicitly allow unrequested and unexpected popups (secondary windows). 

> So is there any way to inform my webapp that the user has closed the page?

Yes. The problem to begin with was multiplication of secondary windows, sub-windows. You do not need (it's not necessary) to create and open a secondary window just to output "The other window went away."

regards, Gérard
Comment 10 Myriam Schweingruber 2012-06-18 14:13:31 UTC
Message from the Bugsquad and Konqueror teams:
This bug is closed as outdated, as we do not have the manpower to maintain the KDE3 version anymore.
If you still can reproduce this issue with Konqueror 4.8.4 or later, please open a new report.
Thank you for your understanding.