如何从 BHO 阻止 window.showModalDialog 弹出窗口?
我正在开发 BHO 弹出窗口/广告拦截器,但我找不到如何阻止此 js 触发的弹出窗口:
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)");
我正在拦截 DISPID_NEWWINDOW、DISPID_NEWWINDOW2 和 DISPID_NEWWINDOW3,但这些都没有被触发,但弹出窗口确实打开了。
如何阻止此类弹出窗口?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我对 IE BHO 不太熟悉,但是,关于 JavaScript 本身:您是否考虑过在页面开头添加
window.showModalDialog = new Function();
例如,通过插入 new
< ;script>
作为的第一个子元素(在 IE8/XP 中阻止我弹出窗口),或者这太残酷了(因为它根本阻止了模式对话框)?
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)?