Freigeben über


pop-up blocker and ActiveX controls, part one: IWebBrowser::Navigate(), IWebBrowser::Navigate2()

As I mentioned previously, one reason users may continue to experience unwanted pop-up windows while browsing is creative use of ActiveX controls that provide methods that allow web sites to open new browser windows.  This series of posts will provide best-practices for ActiveX control implementors.

There are two things to keep in mind while considering this topic.  The first is, as always, we are committed to application and site compatibility and thus a lot of the pop-up blocker is opt-in and in the abscence of concrete knowledge that a pop-up is unwanted, our default is often to allow the pop-up.  The second thing is there are an incredible number of ways to navigate IE, so this will, necessarily, be part one in a survey of this multitude.

Note: If you are a user (and not an ActiveX control developer), and have found this post in an attempt to track down why you are still seeing unwanted pop-up windows, please refer to this post. 

Method: IWebBrowser::Navigate(), IWebBrowser2::Navigate2()
Mitigation: Each of these methods takes a set of BrowserNavConstants in the Flags parameter.  Controls (and applications) should pass navNewWindowsManaged if they desire pop-up blocker to be applied.  Clues that you want this flag would be such things as you are also passing navOpenInNewWindow or are targeting a frame name via the TargetFrameName parameter and that frame may not exist--in which case a new browser window may be created with that name.

Comments