阻止来自webbrowser中服务器的消息框 [英] Blocking message boxes from server in webbrowser

查看:94
本文介绍了阻止来自webbrowser中服务器的消息框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,

好​​吧,伙计们,对不好的问题抱歉,我会试着更好地解释一下。我只有简单的webBrowser,我想尝试使用它来避免从随机服务器弹出消息。那个弹出消息看起来就像普通的消息框一样,但是因为有人告诉我那里没有像服务器那样的消息框,所以我不知道如何调用它:D。当您单击网站上的按钮时,它会弹出。所以我在考虑是否有某种类型的代码可以关闭/阻止它而无需用户干扰。也许使用消息'标题的某种块就足够了:)。但是在搜索了几个小时之后,我发现它都是INewWindowManager接口而我无法让它工作。我没有任何特殊的代码,我只是使用webBrowser和我试图这样做的网站不是我的,所以我不能提供我的任何代码。

谢谢任何帮助!

Hello,
Alright guys, sorry for bad question, I''ll try to explain it better. All I have is simple webBrowser and I want to try to use it to avoid popping message from random server. That "popping message" looks exactly like normal message box but since somebody told me there''s nothing like message box from server then I have no idea how to call it :D. It pops out when you click on the button on the website. So I was thinking about if there''s some kind code which can close/block it without user needing to interfere. Maybe some kind of block using the message''s header would be enough :). But after searching for hours all I''ve found was INewWindowManager interface and I just couldn''t get it to work. I don''t have any special codes for this I just use webBrowser and websites where I''m trying to do this are not mine so I can''t provide any code of mine.
Thanks for any help!

推荐答案

据我所知,您需要阻止诸如alert()或confirm()之类的消息框以确保它们不会卡住你的脚本。如果是,我可以建议在隐藏的浏览器中渲染(执行)以下脚本:



As far as I understand you need to block message boxes like alert(), or confirm() to make sure that they''ll not stuck your scripts. If yes, what can I suggest is to render (execute) following script in your hidden browser:

alert = function(){};
confirm = function(){}; 





在chrome,firefox中完美适用于我,并且在IE中无效。



Works perfectly for me in chrome, firefox, and doesn''t work in IE.


这篇关于阻止来自webbrowser中服务器的消息框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆