Opening a hyperlink in a default browser instead of MSIE.

By default, any hyperlink will open in Microsoft Internet Explorer which is not desired. So, you can use the following snippet so that the links will open in the default web browser.


        private void Form1_Load(object sender, System.EventArgs e)
        {
            var browser = winFormHtmlEditor1.GetTheWebBrowser();
            browser.Navigating += webBrowser1_Navigating;
        }
 
        private void webBrowser1_Navigating(object sender, WebBrowserNavigatingEventArgs e)
        {
            //cancel the current event
            e.Cancel = true;
 
            //this opens the URL in the user's default browser
            Process.Start(e.Url.ToString());
        }
Last updated on Sep 13, 2022