How is this site triggering its popup while bypassing Chrome's pop-up blocker?
I thought pop-up blockers only allowed window.open if it was triggered by a user action but that's not the case here so how are they doing it?
How is this site triggering its popup while bypassing Chrome's pop-up blocker?
I thought pop-up blockers only allowed window.open if it was triggered by a user action but that's not the case here so how are they doing it?
You could use the .trigger method for simulating an user action:
.trigger()
can not be used to mimc such native browser events, you can use .simulate()
fromsimulate.js
to mimic such events.include simulate.js in your file and use,
$('a').simulate('click')
;Tested on my own server, This opens up http://google.com in a new (standalone) window in Chromium 28 on Ubuntu 12.04. Adblock is active.
I figured out that there is an popup opening in chrome if you visit the Website first time (empty cache) and click somewhere on the document. After a refresh and a click on it again nothing will happen if cache wasn't removed.
So lets start the game of reverse engineering...
Took the script from http://undertexter.se/ and startet refuscation.
After a few steps I got the following code and I think this is not planned by browser manufactures to support something like this.
Now I wish you a lot of luck to use that for your own but I think it's evil.
Look on js fiddle for the result: Its the reverse of:
http://jsfiddle.net/W9BdS/
try this using JQuery
window.open
is blocked by modern browsers when called not in aclick
event handler.I faced this myself while using Rails'
format.js
responses and wrote a small plugin that makes showing JS popups as simple as callingwindow.open()
: