You are currently offline, waiting for your internet to reconnect

PRB: WebBrowser Control Clients Share Global Settings

All hosts of the WebBrowser control share the same global Internetsettings.

Commercial WebBrowser control hosts such as the America Online (AOL)browser are affected by this behavior. For example, specifying a defaulthome page for AOL in AOL's WWW preferences will set the same default homepage for both AOL and Internet Explorer (IE), even when IE is usedseparately from AOL.

The third-party products discussed here are manufactured by vendorsindependent of Microsoft; we make no warranty, implied or otherwise,regarding these products' performance or reliability.
For most of the global Internet settings, there is no supported method forautomatically saving a set of properties for each WebBrowser host.

However, certain download options, such as whether to download ActiveXcontrols or not, can be overridden and specified on a per-host basis.
This behavior is by design.
More information
As documented in the Internet Client SDK (InetSDK), WebBrowser hosts canimplement the DISPID_AMBIENT_DLCONTROL ambient property on their defaultdispatch interface to override the global settings for download options.

The WALKALL sample in the InetSDK (\InetSDK\Samples\Walkall) demonstratesthis technique for an MSHTML host. A similar method can be used inWebBrowser hosts to achieve the same effect.

MSHTML will also ask for a new user agent via DISPID_AMBIENT_USERAGENT whennavigating to clicked hyperlinks. This ambient property can be overridden,but it is not used when programmatically calling the Navigate method; it will also not cause the userAgent property of the DOM's navigator object or clientInformation behavior to be altered - this property will always reflect Internet Explorer's own UserAgent string.

An MFC host of the WebBrowser control can easily affect these ambientproperties by overriding the OnAmbientProperty method of the hosting CWnd-based class:
BOOL CWBHostView::OnAmbientProperty(COleControlSite* pSite,                                    DISPID dispid, VARIANT* pvar){USES_CONVERSION;   // Change download properties - no java, no scripts...   if (dispid == DISPID_AMBIENT_DLCONTROL)   {      pvar->vt = VT_I4;      pvar->lVal = DLCTL_NO_SCRIPTS | DLCTL_NO_JAVA                 | DLCTL_NO_RUNACTIVEXCTLS | DLCTL_NO_DLACTIVEXCTLS;      return TRUE;   }   // Change user agent for this web browser host during hyperlinks   if (dispid == DISPID_AMBIENT_USERAGENT)   {      CString strUserAgent("MyWebBrowserHost");      pvar->vt = VT_BSTR;      pvar->bstrVal = ::SysAllocString(T2OLE(strUserAgent));      return TRUE;   }   return CView::OnAmbientProperty(pSite, dispid, pvar);}				
The DISPID_AMBIENT_* and DLCTL_* values are defined in Mshtmdid.h(\InetSDK\Include\MSHTMDID.H).
For more information about developing Web-based solutions for Microsoft Internet Explorer, visit the following Microsoft Web sites:
AOL CompuServe WebBrowser UserAgent

Article ID: 183412 - Last Review: 06/22/2014 18:53:00 - Revision: 4.0

  • kb3rdparty kbFAQ kbprb kbwebbrowser KB183412