“关闭”子 Web 浏览器窗口上的按钮关闭父窗口(.NET、winforms)

发布于 2024-09-25 07:40:30 字数 385 浏览 0 评论 0原文


我使用 WebBrowser 控件允许用户导航到 Intranet Web 门户并将用户保留在 C# 桌面应用程序中。在某些情况下,用户可以单击 html 页面上的链接,并打开 WebBrowser 控件的子窗口(为此,我在父 WebBrowser 控件上订阅了 NewWindow 事件)。
子窗口页面上有“关闭”按钮。就像这样:

当用户单击此按钮时,父级 BrowserControl 窗口将关闭(没有上升关闭/关闭事件)并且子窗口将挂起。

但如果我们在 IE6 中执行相同的步骤 - 一切都会正常。
有什么建议吗?
提前致谢。

I'm using WebBrowser control to allow user navigate to intranet web-portal and keep user in c# desktop application. In some cases user can clicks on link on html-page and child window with WebBrowser control opens(to do that, I subscribed to NewWindow event on parent WebBrowser control).
There is "Close" button on child window's page. It like like that:
<input type="button" name="closeButton" onclick="window.close()">
When user clicks on this button window with parent BrowserControl closes(without rising close/closing events) and child window becomes hanging.

But if we do same steps in IE6 - everything works fine.
Any propositions?
Thanks in advance.

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

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

发布评论

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

评论(1

葬花如无物 2024-10-02 07:40:30

好吧,问题解决了,但方式有点肮脏:打开弹出窗口后,我找到 "closeButton" 并删除其 "onclick" 事件中的代码,然后附加事件“onclick”事件的处理程序(api 允许这样做),其中包含通过 winforms api 手动关闭弹出窗口的代码;

Well, problem was solved, but in a bit dirty way: after opening popup window I find "closeButton" and erase code in its "onclick" event and then I attach event handler to "onclick" event(api allows to do that), which contains code, that closes popup window through winforms api manually;

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