Question

I am working on a BHO popups / ads blocker, and I can't find how to block this js triggered popup:

var popDialogOptions = "dialogWidth:795px; dialogHeight:500px; center:1; menubar:1; tollbar:1; location:0; resizable:1; scroll:1; status:1; fullscreen;yes";
eval("window.showModalDialog('http://uri.com/popup.html,'',popDialogOptions)");

I am intercepting DISPID_NEWWINDOW, DISPID_NEWWINDOW2 and DISPID_NEWWINDOW3 but none of those are being fired, but the popup does open.

How could I block this type of popups?

Was it helpful?

Solution

I'm not very familiar with IE BHOs, however, regarding JavaScript itself: have you considered adding at the beginning of the page

window.showModalDialog = new Function();

e.g. by inserting new <script> as a first child of <head> (prevents popup for me in IE8/XP) or this is too brutal (because it blocks modal dialogs at all)?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top