There are two ways to work around this problem:
- Create a new HTML file inside of the FRAME.
-or-
- Read the existing contents of the current HTML file.
Create a New HTML File
You can use the
IHTMLDocument2::write method to add content to the WebBrowser control. Make sure that you call the
IHTMLDocument2::open method first and the
IHTMLDocument2::close method last. To obtain the
IHTMLDocument2 interface, perform the following steps:
- Load a blank file into the WebBrowser control.
- Call the IWebBrowser2::get_Document method to obtain the IDispatch interface of the document.
- Call QueryInterface on the IDispatch pointer, and ask for IHTMLDocument2.
This code does not work for Internet Explorer versions 5.01 and earlier because these versions cannot obtain the
IWebBrowser2 control (and therefore
IHTMLDocument2) of a FRAME that was created using
IHTMLDocument2::write.
Microsoft recommends that you use version detection in your hosts to switch between solutions, using this workaround to create a new file in Internet Explorer 5.5, and using
IPersistStreamInit in earlier versions of the browser. You can obtain the browser's full version number from the following registry value:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Version
Read Source for the Current HTML File
To obtain this original HTML source without
IPersistStreamInit, you can use the
UrlOpenStream function from the URL Moniker application programming interface (API).