.netwinformsembedded-browser

"Close" button on child WebBrowser window closes an parent one(.NET, winforms)



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.


Solution

  • 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;