New issue
Advanced search Search tips

Issue 843086 link

Starred by 1 user

Issue metadata

Status: WontFix
Owner: ----
Closed: May 2018
Components:
EstimatedDays: ----
NextAction: ----
OS: Windows
Pri: 2
Type: Bug



Sign in to add a comment

Not able to close browser window through JavaScript

Reported by gandhira...@gmail.com, May 15 2018

Issue description

UserAgent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:59.0) Gecko/20100101 Firefox/59.0

Steps to reproduce the problem:
We have a application that opens a new window on login, we want to close the initial window through JavaScript after login.

Sample code is attached

What is the expected behavior?
Expect to close the initial application window through JavaScript

What went wrong?
Not able to close the initial application window through JavaScript

Did this work before? N/A 

Chrome version: 66.0.3359.170  Channel: stable
OS Version: Windows 7 Professional SP1
Flash Version: 

Sample code attached to simulate the scenario
 
window_close.html
458 bytes View Download
Labels: Needs-Triage-M66

Comment 2 by rbyers@chromium.org, May 15 2018

Components: -Blink Blink>WindowDialog
Status: WontFix (was: Unconfirmed)
Sorry, this is by design to prevent abuse.  Notice the devtools console says: "Scripts may close only the windows that were opened by it."

Firefox behaves the same, and says: "Scripts may not close windows that were not opened by script."

I believe this is required by the HTML spec: https://html.spec.whatwg.org/multipage/window-object.html#dom-window-close

Sign in to add a comment