3 ms·
Pages rely on window.open() for all sorts of non-popup things. You can't just break window.open(), or sites like DDG will stop working. Not that there aren't w
by pcwalton 10y ago
Pages rely on window.open() for all sorts of non-popup things. You can't just break window.open(), or sites like DDG will stop working.
Not that there aren't ways to fix this, but in general "remove the offending API" rarely works on the Web. You need a more subtle approach.
- t3nary 10y agoI think OP is rather talking about window.{alert,prompt,confirm}, at least "ie, you can't interact with the page without answering the dialog" hints towards that
- pcwalton 10y agoThat's tricky too. You can't just remove window.prompt, or users won't be able to use pages that rely on it for critical input. So what do you do? window.prompt is a synchronous API; you have to return something to the code that called it. You might say "well, just suspend that function and let the user interact with the rest of the page". But by doing that you've introduced coroutines to JavaScript (since "interacting with the rest of the page" means "running JS"), which is a huge change that comes with a mountain of tricky interactions. Even if it could be made to work (which most browser vendors think is impossible), it would still break pages that didn't expect random state to change across the window.prompt call.
- ben0x539 10y agoIt'd be cool if window.open() just took some screen real-estate from the calling page, tho, instead of letting some content escape the shackles of its tab.