I have a textBox and a webBrowser control in my Windows Forms application. Whenever a user enters a HTML code in textBox, the webBrowser control shows its compiled form. The
I would like to add something more to this answer,
Coz webBrowser1_Navigating method is executed everytime when the content of the webBrowser is changed.
In your case whenever you set the values to DocumentText this method is called and when there is no url and its default value is about:blank. So we should also check this for otherwise it won't load any content.
private void webBrowser1_Navigating(object sender, WebBrowserNavigatingEventArgs e)
{
if (!(e.Url.ToString().Equals("about:blank", StringComparison.InvariantCultureIgnoreCase)))
{
System.Diagnostics.Process.Start(e.Url.ToString());
e.Cancel = true;
}
}