Closed Bug 183697 (WindowClose) Opened 17 years ago Closed 17 years ago

javascript call "window.close()" and "self.close()" do not close windows

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set

Tracking

()

VERIFIED INVALID

People

(Reporter: brian, Assigned: rogerl)

References

()

Details

User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2) Gecko/20021203
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2) Gecko/20021203

When the javascript calls to window.close() or self.close() are executed, the
window does not close

Reproducible: Always

Steps to Reproduce:
1.Open mozilla browser
2.go to http://makingconnections.utsa.edu/mcsa/inforef/WestSideBigMap.htm (or
anywhere else that has a window.close() call)
3.Click on the "Click here to close this window" link

Actual Results:  
When the above steps are performed, the window does not close.

Expected Results:  
The window was expected to close

Bug occurs across themes on all close() calls
Just checked, and this bug is *not* present in the 1.2b release

(Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2b) Gecko/20021017, build 20002101717)
WFM - 3 hours old CVS based build, winXP-Sp1.

Well, see bug 32571 to have an explanation.
Yep.  If you didn't open the window with javascript you can't close it with
javascript.  The fact that you could before was a bug.
Status: UNCONFIRMED → RESOLVED
Closed: 17 years ago
Resolution: --- → INVALID
Marking Verified -

BTW, this isn't JavaScript Engine. The language engine contains no
DOM objects such as |window|. Just abstract objects such as |Date|,
|String|, |RegExp|, etc.
Status: RESOLVED → VERIFIED
This problem persists in v 1.2.1 on Windows.  My user-agent string:

Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.2.1) Gecko/20021130

This used to work under v1.0

Jon, this is marked invalid.  That means that it is not a bug.  The fact that it
worked in 1.0 is a bug in 1.0.
I see.  However, if I may make a further comment.  This feature has existed in
other browsers for some time.  There are extensive documents on the web that
describe this action to close the browser window.  Removing this feature will
affect many applications and websites that make use of it.  I suggest that it
remain part of the browser, with an optional prefs.js directive to disable it if
the individual desires.
Jon, web sites can still close any window that they open.  They just can't close
windows they didn't create. This is exactly what Netscape 4 does, and it should
really not be any other way.  The browser belongs to the _user_, not the website.
According to
http://developer.netscape.com/docs/manuals/js/client/jsref/window.htm#1201822):

"The close method closes only windows opened by JavaScript using the open
method. If you attempt to close any other window, a confirm is generated, which
lets the user choose whether the window closes."

So, according to the above doc, the method should work, even if it generates a
confirmation message.  The trouble is, nothing happens at all.
See discussion in bug 32571.  It seems that the dialog was dropped at some
point. Perhaps a bug on the Security:General component requesting such a dialog
is in order.
Done - <a href="http://bugzilla.mozilla.org/show_bug.cgi?id=190515">Bug
190515</a>.  Thanks for the suggestion.  
*** Bug 207267 has been marked as a duplicate of this bug. ***
*** Bug 190752 has been marked as a duplicate of this bug. ***
*** Bug 229189 has been marked as a duplicate of this bug. ***
*** Bug 245975 has been marked as a duplicate of this bug. ***
*** Bug 273375 has been marked as a duplicate of this bug. ***
*** Bug 278564 has been marked as a duplicate of this bug. ***
Alias: WindowClose
OS: Linux → All
Hardware: PC → All
*** Bug 280300 has been marked as a duplicate of this bug. ***
*** Bug 286258 has been marked as a duplicate of this bug. ***
*** Bug 287068 has been marked as a duplicate of this bug. ***
*** Bug 297020 has been marked as a duplicate of this bug. ***
*** Bug 313032 has been marked as a duplicate of this bug. ***
Duplicate of this bug: 361648
Duplicate of this bug: 368313
Component: JavaScript Engine → DOM
this bug should probably be marked as a dup of bug 190515

anyone who is interested in this issue should certainly take a look at it.
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.