“关闭”子 Web 浏览器窗口上的按钮关闭父窗口(.NET、winforms)
我使用 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好吧,问题解决了,但方式有点肮脏:打开弹出窗口后,我找到
"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;