Closed
Bug 304965
Opened 20 years ago
Closed 20 years ago
window.open fails upon user initiated keypress
Categories
(Core :: DOM: Core & HTML, defect)
Tracking
()
RESOLVED
DUPLICATE
of bug 257870
People
(Reporter: danswer, Unassigned)
Details
Attachments
(1 file)
|
565 bytes,
text/html
|
Details |
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8b2) Gecko/20050620 Firefox/1.0+
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8b2) Gecko/20050620 Firefox/1.0+
As I understand the intent of the popup blocker (which is active on my system),
it should only and exactly allow popups (unless site excepted) based on concrete
user initiated action. That "concrete" means things that indicate the user is
interacting with the page, such as mouse clicks and button pressing or other
control element interactions. It does not include things like mouse movements
nor any actions initiated before load is complete nor window.setTimeout
initiated actions.
Bug: If I press a key when the loaded page has focus, and I have an event
listener for that, it's pretty clear that the user is interacting with the page.
I should be able to do a window.open(), but I cannot.
You could argue that things like page up/down, maybe the arrow keys, alt+tab
variations, ctrl+w, Alt+F4 do not indicate page interactions. That is OK by me,
but if I press the Insert key or a ctrl+character combination or any other key
combination about which we can conclusively say that it is not being used for
manipulation of the browser itself (as opposed to the page therein), then I
expect to be able to activate window.open()
Csaba Gabor from Vienna
Here is a demo script:
<html><head><title>window.open failing with keypress</title></head>
<body bgcolor=yellow>
<button type=button id=input
style="background-color:yellow;border:solid 0px yellow">Press the ESC key</button>
<script type='text/javascript'>
document.onkeypress=function(event) {
if (event.keyCode==27) {
var newWin = window.open();
if (newWin) newWin.document.body.innerHTML = "window.open() success";
else alert("Bug - window.open() has failed");
} }
document.getElementById('input').focus();
</script></body></html>
Reproducible: Always
Steps to Reproduce:
Press the ESCAPE key. Clearly a user initiated action, but it blocks window.open
| Reporter | ||
Comment 1•20 years ago
|
||
This enclosed attachment has the same code that is at the end of the initial
bug report (except that I changed event to (event||window.event) so it now
works with IE).
Related to/duplicate of bug 257870?
Comment 3•20 years ago
|
||
*** This bug has been marked as a duplicate of 257870 ***
Status: UNCONFIRMED → RESOLVED
Closed: 20 years ago
Resolution: --- → DUPLICATE
You need to log in
before you can comment on or make changes to this bug.
Description
•