window.close() for non-script-owned windows is ignored (should create a dialog or "please close me" page)
Categories
(Core :: DOM: Core & HTML, defect, P5)
Tracking
()
People
(Reporter: jearle, Unassigned)
References
()
Details
(Whiteboard: Proposed UI in comment 24)
Attachments
(1 file)
5.55 KB,
patch
|
Details | Diff | Splinter Review |
Updated•22 years ago
|
Comment 3•22 years ago
|
||
Comment 5•22 years ago
|
||
Comment 6•22 years ago
|
||
Comment 8•22 years ago
|
||
Comment 9•22 years ago
|
||
Comment 10•22 years ago
|
||
Comment 11•22 years ago
|
||
Comment 12•22 years ago
|
||
Reporter | ||
Comment 13•22 years ago
|
||
Comment 14•22 years ago
|
||
Comment 15•22 years ago
|
||
Comment 16•22 years ago
|
||
Comment 17•22 years ago
|
||
Comment 18•22 years ago
|
||
Comment 19•21 years ago
|
||
Comment 21•21 years ago
|
||
Comment 22•20 years ago
|
||
Comment 23•20 years ago
|
||
Comment 24•20 years ago
|
||
Comment 25•20 years ago
|
||
Comment 26•20 years ago
|
||
Comment 27•19 years ago
|
||
Comment 28•19 years ago
|
||
Comment 29•19 years ago
|
||
Comment 30•19 years ago
|
||
Comment 31•18 years ago
|
||
Comment 32•18 years ago
|
||
Comment 33•18 years ago
|
||
Comment 34•18 years ago
|
||
Comment 35•18 years ago
|
||
Comment 36•18 years ago
|
||
Comment 37•18 years ago
|
||
Comment 38•18 years ago
|
||
Comment 39•18 years ago
|
||
Comment 40•18 years ago
|
||
Comment 41•18 years ago
|
||
Comment 42•18 years ago
|
||
Comment 43•18 years ago
|
||
Comment 44•18 years ago
|
||
Comment 45•18 years ago
|
||
Comment 46•18 years ago
|
||
Comment 47•18 years ago
|
||
Comment 48•18 years ago
|
||
Comment 49•18 years ago
|
||
Comment 50•18 years ago
|
||
Comment 51•18 years ago
|
||
Comment 52•17 years ago
|
||
Comment 53•17 years ago
|
||
Comment 54•17 years ago
|
||
Comment 55•17 years ago
|
||
Comment 56•17 years ago
|
||
Comment 57•17 years ago
|
||
Comment 58•17 years ago
|
||
Comment 59•17 years ago
|
||
Comment 60•17 years ago
|
||
Comment 61•17 years ago
|
||
Comment 62•17 years ago
|
||
Comment 63•17 years ago
|
||
Comment 64•17 years ago
|
||
Comment 65•17 years ago
|
||
Comment 66•17 years ago
|
||
Comment 67•16 years ago
|
||
Comment 68•16 years ago
|
||
Comment 69•16 years ago
|
||
Comment 70•16 years ago
|
||
Comment 71•16 years ago
|
||
Updated•16 years ago
|
Updated•16 years ago
|
Comment 72•7 years ago
|
||
Assignee | ||
Updated•6 years ago
|
Comment 74•4 years ago
|
||
I do agree this report.
I think this warning "scripts may close only the windows that were opened by them" has a serious usability issue.
The same behavior has been seen in Google Chrome for a long time, but I've always been skeptical of this behavior.
I wonder why this isn't solved for 18 years.
For example, suppose your page has a button that says "Close window".
This warning does not always occur. There seems to be certain conditions for this warning to occur.
Most users cannot notice the warning because they are not engineers. They don't even know the existence of DevTools (F12).
What is worse, mobile users also cannot see the warning because mobile browsers don't have DevTools.
When clicking/tapping the "Close window" button, the user expects the tab to close.
However, if the button doesn't do anything, the user is confused because he cannot understand why the button does not work.
Also, this warning without any confirmation suffers web developers.
we should confirm whether the users attempt to close the tab or not, instead of silent error.
Internet Explorer (IE) had a confirmation that says "The webpage you are viewing is trying to close the window. Do you want to close this window?". But the confirmation was so annoying that most users and developers wanted to close the tab immediately. Chrome and Firefox have made that dream come true, under certain conditions.
If the page has window.close(), IE didn't check any conditions, and always asked whether the user wants to close the window or not, under any conditions. That's why the confirmation on IE was annoying.
Instead of abolishing the confirmation, Chrome and Firefox have introduced a warning of "scripts may close only the windows that were opened by them." But the 2 browsers don't ask users anything at all, even if the user wants to close the tab through script. This causes the confusion mentioned at the beginning of this request.
I made a comparison image with IE (Internet Explorer). Please look:
https://1drv.ms/u/s!AntXLFPFHWyhxhHZAk6ERYRrrCjr
Updated•3 years ago
|
Comment 75•3 years ago
|
||
I think it would be best (exactly like the restrictions being placed on window.open()
)
→ if window.close() is called from Script, outside of user interaction event handler (click or touch or keydown or keypress): Still show the warning in console and do nothing → if
window.close()` is called from user interaction event handler (click or touch or keydown or keypress):
Show a confirmation dialog and close on click on "Yes" inside that dialog, do nothing except close the dialog on click on "No" inside the dialog
In short:
→User-intended calls to window.close()
should be executed even if not in script-opened window
→Not-user-intended calls to window.close()
should get blocked if outside script-opened window
Comment 76•2 years ago
|
||
Upvoting -> please fix it
Description
•