Any idea to prevent the load of images (and others) from a remote location?
I have a html file locally having links to images on a remote server.
I want to block those but without parsing the html.
BeforeNavigate does not pass these urls to block.
?
The WebBrowser control has not a method to do it: it leaves the task to the container.
If you use my OLE container, you can pass ambient flags, e.g. %DLCTL_NO_SCRIPTS. in the lParam parameter of CreateWindowEx.
Quote
' Controlling Download and Execution
' The WebBrowser Control gives you control over what it downloads, displays, and executes.
' To gain this control, you need to implement your host's IDispatch so it handles
' DISPID_AMBIENT_DLCONTROL. When the WebBrowser Control is instantiated, it will call your
' IDispatch::Invoke with this ID. Set pvarResult to a combination of following flags, using
' the bitwise OR operator, to indicate your preferences.
' - DLCTL_DLIMAGES, DLCTL_VIDEOS, and DLCTL_BGSOUNDS: Images, videos, and background sounds
' will be downloaded from the server and displayed or played if these flags are set. They
' will not be downloaded and displayed if the flags are not set.
' - DLCTL_NO_SCRIPTS and DLCTL_NO_JAVA: Scripts and Java applets will not be executed.
' - DLCTL_NO_DLACTIVEXCTLS and DLCTL_NO_RUNACTIVEXCTLS : ActiveX controls will not be
' downloaded or will not be executed.
' - DLCTL_DOWNLOADONLY: The page will only be downloaded, not displayed.
' - DLCTL_NO_FRAMEDOWNLOAD: The WebBrowser Control will download and parse a frameSet, but
' not the individual frame objects within the frameSet.
' - DLCTL_RESYNCHRONIZE and DLCTL_PRAGMA_NO_CACHE: These flags cause cache refreshes. With
' DLCTL_RESYNCHRONIZE, the server will be asked for update status. Cached files will be
' used if the server indicates that the cached information is up-to-date. With
' DLCTL_PRAGMA_NO_CACHE, files will be re-downloaded from the server regardless of the
' update status of the files.
' - DLCTL_NO_BEHAVIORS: Behaviors are not downloaded and are disabled in the document.
' - DLCTL_NO_METACHARSET_HTML: Character sets specified in meta elements are suppressed.
' - DLCTL_URL_ENCODING_DISABLE_UTF8 and DLCTL_URL_ENCODING_ENABLE_UTF8: These flags function
' similarly to the DOCHOSTUIFLAG_URL_ENCODING_DISABLE_UTF8 and DOCHOSTUIFLAG_URL_ENCODING_ENABLE_UTF8
' flags used with IDocHostUIHandler::GetHostInfo. The difference is that the DOCHOSTUIFLAG
' flags are checked only when the WebBrowser Control is first instantiated. The download
' flags here for the ambient property change are checked whenever the WebBrowser Control
' needs to perform a download.
' - DLCTL_NO_CLIENTPULL: No client pull operations will be performed.
' - DLCTL_SILENT: No user interface will be displayed during downloads.
' - DLCTL_FORCEOFFLINE: The WebBrowser Control always operates in offline mode.
' - DLCTL_OFFLINEIFNOTCONNECTED and DLCTL_OFFLINE: These flags are the same. The WebBrowser
' Control will operate in offline mode if not connected to the Internet.
' DISPID_AMBIENT_DLCONTROL and the flag values are defined in mshtmdid.inc.
' Initially, when the function call to IDispatch.Invoke starts, the VARIANT to which the
' parameter pvarResult points is of type VT_EMPTY. You must switch the type to VT_I4 for
' any settings to have an effect. You can place your flag values in the lVal member of the VARIANT.
' Most of the flag values have negative effects, that is, they prevent behavior that normally
' happens. For instance, scripts are normally executed by the WebBrowser Control if you
' don't customize its behavior. But if you set the DLCTL_NOSCRIPTS flag, no scripts will
' execute in that instance of the control. However, three flags—DLCTL_DLIMAGES, DLCTL_VIDEOS,
' and DLCTL_BGSOUNDS—work exactly opposite. If you set flags at all, you must set these three
' for the WebBrowser Control to behave in its default manner vis-a-vis images, videos and sounds.
Thanks, no atl solution heh? :)
If not then i may try yours later on.
For now i *did* rename all http:// parts, bit so-so..
ATL has an iunterface called IAxWinAmbientDispatch that has a DocHostFlags property. Never have used it though.