I use the OnNewWindow2 Method from my WebBrowser2 Control to prevent that
new Instances from the IE will be created;
It works fine with nearly all Websites, but if the window.open method called
when the website is unloading (for example www.sex.de), the OnNewWindow2 will
not called and a new Instance will be created:(
thanks in advance
Marc
This happens because you are unadvising your sink while there's still a
page loaded into the control. Then you destroy the control, it fires
onunload event on the page, and the page opens a popup, but you no
longer have a sink attached to handle NewWindow2 event.
Probably the easiest workaround is to navigate WebBrowser to about:blank
right before closing the app. This way the current page will unload
while you still have your sinks attached.
--
With best wishes,
Igor Tandetnik
"On two occasions, I have been asked [by members of Parliament], 'Pray,
Mr. Babbage, if you put into the machine wrong figures, will the right
answers come out?' I am not able to rightly apprehend the kind of
confusion of ideas that could provoke such a question." -- Charles
Babbage