pop-up blocker and ActiveX controls, part two: HlinkSimpleNavigateToMoniker()
Note: This is part two in a series of posts explaining how ActiveX controls and the IE Pop-up Blocker should interact. The first post is here. 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: HlinkSimpleNavigateToMoniker(), HlinkSimpleNavigateToString().
Mitigation: I would like to discourage you from calling these functions. They are not, in my opinion, very good functions. If your control must navigate, you should use the IWebBrowser2 function. If you are already calling these functions, and cannot change things, then what you must do is pass the correct pointer in the pUnk parameter. The documentation implies that if pUnk is NULL and you are an ActiveX control then your navigation will not succeed. This is not the case--the function has no good way to even tell if you are an ActiveX control or not. You identify yourself as one or the other by passing or not passing a non-NULL value. If you pass NULL, then the pop-up blocker will not get involved. If, however, you pass a non-NULL value, you have identified yourself as an ActiveX control and pop-up blocking will be in effect. You should not lie to this function.
The documentation is also not very clear on what, exactally, you should pass in the pUnk parameter or what it is used for. Your control is being hosted by mshtml. You should pass a pointer to your client site, which is the object in mshtml hosting you. The HlinkSimpleNavigate functions will attempt to query this object for various interfaces related to pop-up blocking if your call is going to result in a new window. If they fail, your new window will be blocked and the HlinkSimpleNavigate function will return E_ACCESSDENIED. For more information about client site pointers, see this post.
Additionally the function will attempt to get pointers to various webbrowser interfaces to perform the navigation (whether it is a new window or not). If this fails (because you passed NULL) a new browser process will be created and navigated.
Comments
Anonymous
January 11, 2007
PingBack from http://www.ie7security.net/2007/01/11/pop-up-blocker-and-activex-controls-part-two-hlinksimplenavigatetomoniker/Anonymous
January 21, 2007
PingBack from http://www.ie7security.net/2007/01/21/pop-up-blocker-and-activex-controls-part-two-hlinksimplenavigatetomoniker-2/Anonymous
January 21, 2007
PingBack from http://www.ie7security.net/2007/01/21/pop-up-blocker-and-activex-controls-part-two-hlinksimplenavigatetomoniker-3/Anonymous
February 08, 2007
PingBack from http://www.ie7security.net/2007/02/08/pop-up-blocker-and-activex-controls-part-two-hlinksimplenavigatetomoniker-2/Anonymous
August 14, 2008
PingBack from http://www.ie7security.net/2008/08/14/pop-up-blocker-and-activex-controls-part-two-hlinksimplenavigatetomoniker-3/Anonymous
February 21, 2009
PingBack from http://www.ie7security.net/2009/02/21/pop-up-blocker-and-activex-controls-part-two-hlinksimplenavigatetomoniker-4/Anonymous
May 03, 2009
PingBack from http://www.ie7security.net/2009/05/03/pop-up-blocker-and-activex-controls-part-two-hlinksimplenavigatetomoniker-5/