This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.
https://html.spec.whatwg.org/multipage/browsers.html#dom-window-close currently says: > The close() method on Window objects should, if all the following conditions > are met, close the browsing context A: > > * The corresponding browsing context A is script-closable. > * The responsible browsing context specified by the incumbent settings object > is familiar with the browsing context A. > * The responsible browsing context specified by the incumbent settings object > is allowed to navigate the browsing context A. > > A browsing context is script-closable if it is an auxiliary browsing context > that was created by a script (as opposed to by an action of the user), or if > it is a top-level browsing context whose session history contains only one > Document. Consider the following HTML: <body> <script> window.addEventListener("beforeunload", function() { window.close() }, false); </script> </body> If I understand the current spec correctly, if a page like this is loaded as the first document in a browsing context, and the user then attempts to navigate the page to any other page/address, say, https://whatwg.org/, then per spec the browsing context should close. This does not seem optimal to me, and as best I can tell, is not what Blink implements (window.close gets ignored), while Trident prompts the user, and Gecko currently reacts as per spec in this case. I think the Blink behaviour makes some sense, and I think the spec should be brought in line with it.
https://github.com/whatwg/html/issues/4466