Bug 91722
Summary: | Executing window.open with setTimeout does not work | ||
---|---|---|---|
Product: | WebKit | Reporter: | Norimasa Hayashida <nhayashida> |
Component: | New Bugs | Assignee: | Nobody <webkit-unassigned> |
Status: | UNCONFIRMED | ||
Severity: | Minor | CC: | abarth, ap |
Priority: | P2 | ||
Version: | 528+ (Nightly build) | ||
Hardware: | Mac (Intel) | ||
OS: | OS X 10.7 |
Norimasa Hayashida
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
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
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
> 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
> 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