AdBlock sometimes fails to block popups, so using Greasemonkey I want to write my own popup blocker using jQuery.
Is there a way I can intercept the clicks and detect if it’s going to open a popup?
$('.popupLauncher').each(function(){
if( /* $(this) will open a popup */ ){
return false;
}
});
With what can I replace /* $(this) will open a popup */ ?
How do you open a popup using javascript ?
So in theory you can re-write the
window.openfunction to do something else rather than opening a popup.However it might break the page scripts if
window.openisundefinedwhen being called.Therefore I think the best approach would be:
I haven’t tested this code, but as i said, in theory it should work.