WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
UNCONFIRMED
91722
Executing window.open with setTimeout does not work
https://bugs.webkit.org/show_bug.cgi?id=91722
Summary
Executing window.open with setTimeout does not work
Norimasa Hayashida
Reported
2012-07-19 00:47:12 PDT
Executing window.open with setTimeout (e.g. setTimeout(function(){ window.open("
http://www.webkit.org
"); }, 0);) does not work. A given url should be opened in a separate window. Such JavaScript code works on the other browsers.
Attachments
Add attachment
proposed patch, testcase, etc.
Alexey Proskuryakov
Comment 1
2012-07-19 12:31:36 PDT
I think that it's intentional as part of pop-up blocking. Is this breaking an existing site, or a project that you're working on? In the latter case, what are you trying to achieve at high level?
Norimasa Hayashida
Comment 2
2012-07-19 12:51:41 PDT
Disabling the "Block pop-up windows" option seems to resolve this issue. I feel strange a bit because just executing window.open("
http://www.webkit.org
"); works even the option is enabled, and also executing setTimeout(function(){ window.open("
http://www.webkit.org
"); }, 0);) works on WebKit for Windows even the option is enabled. I just want to open a page in a separate window (or tab) few seconds after a user clicks a link.
Alexey Proskuryakov
Comment 3
2012-07-19 13:32:07 PDT
> I feel strange a bit because just executing window.open("
http://www.webkit.org
"); works even the option is enabled, and also executing setTimeout(function(){ window.open("
http://www.webkit.org
"); }, 0);) works on WebKit for Windows even the option is enabled.
window.open only works when invoked from a user gesture handler (such as a click event handler).
> I just want to open a page in a separate window (or tab) few seconds after a user clicks a link.
It might be possible to keep user gesture flag in code run inside setTimeout, but I'm not sure about the tradeoffs.
Adam Barth
Comment 4
2012-07-19 13:41:20 PDT
> It might be possible to keep user gesture flag in code run inside setTimeout, but I'm not sure about the tradeoffs.
We do keep it in some cases. I think there's a time limit and a limit to how much we'll chain it from timeout to timeout. These things are supposed to match other browsers
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug