If instead of navigating to a webpage in a WebBrowser, you want to set the HTML property directly, what's the proper way to do it?
Is it like this?
myWebBrowser.Navigate("about:blank");
myWebBrowser.Document.Write("<html><body>Test</body></html>");
If instead of navigating to a webpage in a WebBrowser, you want to set the HTML property directly, what's the proper way to do it?
Is it like this?
myWebBrowser.Navigate("about:blank");
myWebBrowser.Document.Write("<html><body>Test</body></html>");
You can also use WebBrowser.DocumentStream Property to write the data you need.
Using this (instead of the about:blank document.write combo):
myWebBrowser.DocumentText = sourceCode;
seems to solve various issues such as running the following JavaScript when IE7 is installed on the system:
window.location = "#test";
If IE 7 is installed, this will cause an Error: Invalid argument message to appear.