Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Problems wirh OnNewWindow2

0 views
Skip to first unread message

Scherer@discussions.microsoft.com Marc Scherer

unread,
Oct 29, 2004, 11:34:02 AM10/29/04
to
Hello,

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

Igor Tandetnik

unread,
Oct 29, 2004, 1:01:16 PM10/29/04
to
"Marc Scherer" <Marc Sch...@discussions.microsoft.com> wrote in
message news:C20486EB-0ABE-4575...@microsoft.com

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


0 new messages