What is the correct way to write HTML in WebBrowser in C #?

If instead of going to a web page in WebBrowser, you want to set the HTML property directly, what is its correct way?

This is true?

myWebBrowser.Navigate("about:blank"); myWebBrowser.Document.Write("<html><body>Test</body></html>"); 
+4
source share
2 answers

Using this (instead of the about: blank document.write command):

 myWebBrowser.DocumentText = sourceCode; 

seems to solve various problems, such as starting the following JavaScript when IE7 is installed on the system:

 window.location = "#test"; 

If IE 7 is installed, this will result in the message Error: Invalid argument .

+5
source

You can also use the WebBrowser.DocumentStream property to record the data you need.

+1
source

Source: https://habr.com/ru/post/1299633/


All Articles