Hacker News new | ask | show | jobs
by alopecoid 4187 days ago
A bit off topic, but could someone explain to me why it's so difficult for a browser (or extension) to effectively block 100% of all pop-ups/pop-unders? I realize that these account for only a fraction of ads, but they are really annoying and it seems that these should be the easiest to detect; doesn't this essentially boil down to a few specific API calls? For the few cases that a pop-up/pop-under is legitimate (really, are there any?), I'd be fine whitelisting these on a case-by-case basis.
2 comments

Effectively you're asking for all document.createElement calls to be blocked. Those are used for all sorts of things that aren't ads or popups. Blocking that would probably cause a very large percent of pages to be completely broken.
So there's no explicit way to distinguish between "new window" calls from other types of calls? I'm kind of shocked that, with all the effort that's been put into browsers in recent years, that the ability to "create a new window" hasn't been removed entirely from the API without explicit user consent. Again, I can't think of a single site that uses this feature legitimately.
If you're talking about actual new windows that are a separate process, those have been blocked by popup blockers for years. As far as popovers that block the screen/annoy you, those are just HTML elements that are positioned on top of normal content - its not a "special" thing backed into the DOM API. There's really no effective way to stop a page from being able to do that unless you disable javascript entirely.
There have been tricks that get popups through, possibly by exploiting browser bugs or opening the popup in one of the few on* handlers where browsers allow them.
I use strict pop up blocker on firefox which works great. There's a toggle button in case a site doesn't work properly.

https://addons.mozilla.org/en-US/firefox/addon/strict-pop-up...

They generally get around it by opening the popup when you click anywhere on the page.