阻止来自webbrowser中服务器的消息框

编程入门 行业动态 更新时间:2024-10-21 15:46:56
本文介绍了阻止来自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中服务器的消息框

本文发布于:2023-11-25 02:54:14,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1628030.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:消息   服务器   webbrowser

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!