是否可以防止 WebBrowser 控件由于调用 window.close() 的脚本而被释放?
有什么方法可以中和“window.close()”调用吗?我得到的最接近的是:
但是,通过阅读上面链接的文章,我感觉到“window.close()”决定了 Web 浏览器控件的命运,并且其父窗体继续前进的唯一方法是完全关闭丢弃网络浏览器并当场更换为新浏览器(如本文链接之一所述)。
Is there any way to neutralize 'window.close()' calls? The closest I got was this:
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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这个问题已经在下面的链接中得到了回答,根据它,人们确实可以通过 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()