RESOLVED WORKSFORME 16175
javascript:self.close();" close window javascript doesn't work when window is a tab
https://bugs.webkit.org/show_bug.cgi?id=16175
Summary javascript:self.close();" close window javascript doesn't work when window is...
Theodore Lee
Reported 2007-11-28 12:01:34 PST
Using the following javascript/html code: <form><input type="button" value="Close Window" onClick="javascript:self.close();"></center></form> Safari will close a window, but only when that Window is not a tabbed window. When you have this code in a window that is a tab, pressing the button does nothing.
Attachments
test case (100 bytes, text/html)
2007-12-03 02:15 PST, Alexey Proskuryakov
no flags
David Kilzer (:ddkilzer)
Comment 1 2007-11-28 23:23:18 PST
JavaScript can only close windows it opened, and since it can't open a tab without user interaction, it can't close tabs either. It would be interesting to have support for an "_tab" target, though, that would open a new tab (as "_blank" opens a new window).
Theodore Lee
Comment 2 2007-11-29 06:31:02 PST
The behavior in Firefox is that this Javascript will close a page (whether it is a free standing Window or a tab) without any issues. IE7 will close the page as well (again, whether a free standing Window or tab), but offers up a confirmation dialog before it will close. In each of these circumstances, the page/tab with the containing code is not a page that was opened by Javascript, but rather, by clicking through a link or landing on a page after submitting a form. I agree that it would be nice to have a "_tab" target, to bring Safari inline with other browsers behavior (and make it more compatible with today's web apps), the behavior should be changed to mirror Firefox/IE in that this javascript will close the Window, regardless of whether it is a free standing Window or a tab.
Alexey Proskuryakov
Comment 3 2007-12-03 02:15:52 PST
Created attachment 17671 [details] test case Same test, as an attachment.
Alexey Proskuryakov
Comment 4 2007-12-03 02:18:49 PST
I cannot reproduce this issue with Safari 3.0.4 or TOT on Tiger or Leopard. I've been opening two tabs with the test case, and clicking the Close button - it worked fine. I suspect a conflict with a Safari extension - do you have any installed?
Robert Blaut
Comment 5 2008-12-29 04:21:13 PST
(In reply to comment #4) > I cannot reproduce this issue with Safari 3.0.4 or TOT on Tiger or Leopard. > I've been opening two tabs with the test case, and clicking the Close button - > it worked fine. > > I suspect a conflict with a Safari extension - do you have any installed? > I also cannot reproduce the reported problem in WebKit r39474.
Thierry Vignaud
Comment 6 2009-10-14 07:30:15 PDT
Still valid as of webkit-1.1.15.1 as used by epiphany-2.28.0 or midori-0.1.10. Duplicate of bug #13474 IMHO
Note You need to log in before you can comment on or make changes to this bug.