0

I'm trying to use the WebBrowser in WPF C# to navigate through the Internet. However, when I get to certain webpages e.g. 9gag.com the JavaScript parts of the page don't work and throw an WebBrowser specific error. Since some pages use JavaScript to navigate to their login, I want to enable JavaSrcipt in the WebBrowser and not just ignore the errors!

I use this setup:

namespace WebBrowserHelloworld
{
    public partial class MainWindow : Window
    {
        WebBrowser mainBrowser = new WebBrowser();
        public MainWindow()
        {
            InitializeComponent();
            mainBrowser.Source = new Uri("https://google.com");
            maingrid.Children.Add(mainBrowser);
        }
    }
}

If possible I would like to keep this setup but I appreciate other solutions as well! Thank you! (This is my first question posted, please tell me if I can improve the question!)

  • Hi, first you should enable the latest installed IE version for WebBrowser control. Check this thread https://stackoverflow.com/questions/17922308/use-latest-version-of-internet-explorer-in-the-webbrowser-control In case of more errors you should you native IE com interfaces to implement and handle of errors – Pavel Anikhouski Feb 25 '19 at 09:50
  • You may well find setting registry to try and force IE11 to work as IE11 rather than IE7 does not work. It could well be to do with the way javascript is used to detect browser versions. Although xaml islands are still preview only you might want to consider that approach since it uses Edge. https://learn.microsoft.com/en-us/windows/uwp/xaml-platform/xaml-host-controls – Andy Feb 25 '19 at 09:56

0 Answers0