C# webBrowser script error

后端 未结 6 1164
孤城傲影
孤城傲影 2021-01-02 15:08

I keep getting a script error when trying to load the page using webBrowser.Navigate(\"https://home.nest.com/\"). It will pull up fine from my normal internet

6条回答
  •  春和景丽
    2021-01-02 15:40

    The WebBrowser control is capable of rendering most web pages, but by default it attempts to render pages in compatibility mode (pretty much IE7, hence the issues). If you are building your own page, it's simple, just add the following tag to the header and it should render fine...

    
    

    However, if you are trying to render a third party site you cannot add tags to, things get more difficult. As mentioned above, you can use a registry key (HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION) if it's just on your own machine.

    If neither of these options are a possible solution, using a different browser control (again, great suggestions above) is pretty much your only option.

    There's a great blog on controlling the browser control compatibility mode at https://docs.microsoft.com/en-gb/archive/blogs/patricka/controlling-webbrowser-control-compatibility

提交回复
热议问题