On both Chrome and Firefox I am unable to reliably block popups without extensions. Though both browsers come with such settings, there seems to be ways to circumvent this behavior.
Now why is that? How are sites able to open pop-ups anyway?
On both Chrome and Firefox I am unable to reliably block popups without extensions. Though both browsers come with such settings, there seems to be ways to circumvent this behavior.
Now why is that? How are sites able to open pop-ups anyway?
As a long-term webdev, I've seen this evolve from IE6. This is all by design and consideration actually. Legitimate user-desired actions are not to be blocked. Many corporate portals use popups, as do web-based email, messaging, media players, and more. To developers, "Popups" and "popunders" are unintended and unexpected sub-window openings to be exact. If a site launches a popup, it's because you did something.
The rules for FireFox, Chrome, and Safari are identical: if the popup happens as a result of a user action, like a click or keyboard press, it's allowed. If the popup happens on it's own, it's blocked.
How does the browser determine what caused the action? JavaScript has a way to trace the caller of event-handling function(s) and sub-functions all the way back to a physical user action, like a click. If it doesn't find such a caller on the call stack of the popup-launching code, the popup is blocked. Developers generally cannot extend the user-initiated action until later, you have to window.open()
right away, or else it's blocked. Extensions can block whatever they want, regardless of the user intent, or lack thereof. Links/forms with target=_blank
only fire as a result of user-action, so they need not even be audited.
site A is abusive, block popups regardless if it's user iteration
?
The site that bypass that settings won't open it on a new tab, but in another window using the command: window.open
. There's also this command target="_blank"
but it only a new tab, (I ain't sure about this) and this kind of command is blocked by the pop up blocker of the browser by default
The window.open
isn't easily recognised by the blocker, therefore it might open the pop up, anyway the extensions do a better job about it.
Because "pop-up" is a generic term for a variety of methods of displaying data in a window or modal that displays upon a certain action. There's no one way of creating and displaying a pop up just as there's no one way to do much of anything in the programming and web development world. Sites can use a variety of javascript functions (especially if they also use libraries like jQuery or any number of other javascript frameworks which make displaying modals trivial) or even good ol' HTML to display these windows, so a catch-all solution for getting rid of them is difficult to implement.
Speaking to jQuery specifically, developers have a huge number of triggers that they can use for displaying pop ups, and those popups can take the form of a new tab, new window, creating a new HTML element that displays, displaying a previously hidden/invisible HTML element, and the list goes on...
For example, I could set 3 different triggers for 3 different kinds of popups very simply on one page. First trigger will create a popup anytime the user hovers their cursor over a large div that encompasses the top half of my page. The second trigger will popup whenever a user selects/highlights any text anywhere on the page, and it will display right above the cursor (very common practice with a lot of ad providers that target the specific highlighted text). The final trigger can simply be when a user clicks a button, or to be a little more stealthy, a link on the page. When they click this link it will do two things: first it will trigger a javascript onclick event that I have set to open a predetermined advertisement link in a new window; second it will actually redirect the user to the intended location of the link itself.
Again those are very simplified examples with no code to showcase them (check out http://jquerymodal.com/ for a few examples of what modals can do) but the concepts are very real and very much in use in the wild. It's important to note that not all popups are nefarious or spammy and you should use your own judgement and discretion on whether or not to allow/block them on a per-site basis.