是否可以防止 WebBrowser 控件由于调用 window.close() 的脚本而被释放?

发布于 2024-12-26 11:17:08 字数 455 浏览 2 评论 0原文

有什么方法可以中和“window.close()”调用吗?我得到的最接近的是:

http://blogs.artinsoft.net/Mrojas/archive/2009/05/21/Extended-WebBrowser-Control-Series-WebBrowser-Control-and-windowClose().aspx

但是,通过阅读上面链接的文章,我感觉到“window.close()”决定了 Web 浏览器控件的命运,并且其父窗体继续前进的唯一方法是完全关闭丢弃网络浏览器并当场更换为新浏览器(如本文链接之一所述)。

Is there any way to neutralize 'window.close()' calls? The closest I got was this:

http://blogs.artinsoft.net/Mrojas/archive/2009/05/21/Extended-WebBrowser-Control-Series-WebBrowser-Control-and-windowClose().aspx

However, by reading the article linked above I get the feeling that 'window.close()' seals the fate of the web browser control and that the only way for it's parent form to move on is to completely dispose of the web browser and replace it on the spot with a new one (as described in one of the links of the article).

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

绻影浮沉 2025-01-02 11:17:08

这个问题已经在下面的链接中得到了回答,根据它,人们确实可以通过 DWebBrowserEvents2 接口来中和 window.close() (不知何故,当我研究这个问题时,我没有找到这篇文章):

Web浏览器和 JavaScript window.close()

The question has already been answered in the link below and according to it one can indeed neutralize window.close() by means of DWebBrowserEvents2 interface (somehow I didnt manage to find this post when I was looking into the issue):

WebBrowser and javascript window.close()

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文