I am showing HTML in a windows form where I can edit and quickly see the results. The following code works but if the "ShowString" has a reference to a site that does not allow IE11 then I get an error when the site is accessed.
public ShowPage(string ShowString)
{
InitializeComponent();
webBrowser1.DocumentText = "<!DOCTYPE html><html><head>" + ShowString + "</body></html>";
}
I tried several suggestions to fix WebBrowser but all they did was raise the IE to version 11 which does not help with sites rejecting 11.
I tried WebView2 but it has no DocumentText where I can pass in my html. The only other suggestion was to look at CefSharp. I was unable to get that package into my project and the example project I built did not look like it was useful.
I would like to avoid writing the HTML to a local file and shelling out a real browser. I looked at command line input to chrome but did not see a way to pipe in my HTML text.
The WebBrowser displays the HTML correctly, but if you click on a url some sites will reject the visit.
Thanks for looking!
Using Liu's suggestion the following worked
[edit] Unfortunately, WebView needs to be distributed with my app as it cannot run without it.