none
YouTube Search Error “Google Sorry… We're sorry… … but your computer or network may be sending automated queries” RRS feed

  • Question

  • I have developed Web Browser in VB.Net 2008 and upgrade to visual studio 2013. Before upgrade Web Browser works 100% but after upgrade the error comes with some thing searching in Youtube as below.

    https://www.youtube.com/results?search_query=cricket+highlights

    Google Sorry...

    We're sorry... ... but your computer or network may be sending automated queries. To protect our users, we can't process your request right now. See Google Help for more information.

    Youtube search results are working fine in Internet Explorer, Chrome, Firefox, but not work in my web browser.

    How to fix this i am stuck this point.

    Sample code

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            Dim Browser As New WebBrowser
            Browser.Navigate("www.google.com")
            TabControl1.TabPages.Add("")
            TabControl1.SelectTab(i - 1)
            Browser.Name = "Get Connected Beta v1.0"
            Browser.Dock = DockStyle.Fill
            TabControl1.SelectedTab.Controls.Add(Browser)
            AddHandler Browser.ProgressChanged, AddressOf Loading
            AddHandler Browser.DocumentCompleted, AddressOf Done
            i = i + 1
            CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).ScriptErrorsSuppressed = True
            CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).IsWebBrowserContextMenuEnabled = True
            KeyPreview = True
        End Sub


    Friday, March 30, 2018 6:32 PM

Answers

  • Finally i got the solution.............

    The Web Browser Control is - by default - perpetually stuck in IE 7 rendering mode. Even though we're now up to IE 11 and a reasonably HTML5 compatible browser, the Web Browser Control always uses the IE 7 rendering engine by default. This is because the original versions of the ActiveX control used this mode and for backwards compatibility the Control continues this outdated and very HTML5 unfriendly default.

    This applies whether you’re using the Web Browser control in a WPF application, a WinForms app using the ActiveX control. Behind the scenes all these UI platforms use the same COM interfaces and so you’re stuck with those same rules.

    The good news is there are a couple of ways to override the default rendering behavior:

    • Using the IE X-UA-Compatible Meta header
    • Using Application specific FEATURE_BROWSER_EMULATION Registry Keys

    HTML fix;

    <!DOCTYPE html> 
    <html> 
      <head> 
        <meta http-equiv="X-UA-Compatible" content="IE=edge" /> 
        ... other headers
      </head>
      <body>
        ... content
      </body>
    </html>  

    Via registry;

    Go to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\MAIN\FeatureControl\FEATURE_BROWSER_EMULATION for 64-bit or 32-bit only machines.

    Or go to HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\MAIN\FeatureControl\FEATURE_BROWSER_EMULATION for 32-bit on 64-bit systems (It cannot hurt to add keys to both locations if you have them. If you do not have them, you can make the folders yourself).

    Create a new DWORD key and name it the name of your application e.g. "myapp.exe" and then edit the value of the key. There are many different values you can add depending on the IE version you want to emulate. I entered 11001 (as a decimal value - 0x2AF9 in HEX) which emulates IE 11 (many more values located at: http://msdn.microsoft.com/en-us/library/ee330730%28v=vs.85%29.aspx#browser_emulation).

    If you're using Visual Studio like I am, you'll notice that this method might not even work. However, it does work. You need to manually open the .exe file using Explorer or terminal rather than run the project on Visual Studio.

    If you wish to run the program on Visual Studio then consider adding a key for "myapp.vshost.exe" as this is used for debugging.

    I hope this helps anyone with any issue regarding your Web Browser perhaps using the wrong IE version as a wrapper or functions are not working as intended.


    • Marked as answer by general2000 Monday, April 2, 2018 5:32 PM
    • Edited by general2000 Monday, April 2, 2018 5:38 PM
    Monday, April 2, 2018 5:32 PM

All replies

  • Well I don't really know but you shouldn't have the browser navigate until after you set its properties and add handlers to it and add it as a Control to the Tab controls tab page probably. And rather than converting a type why not just set Browser.ScriptErrors and Context menu separately?

    So I suppose Browser.Navigate should be before or after KeyPreview = True.

    Also I don't see how the TabControl can have a selected Tab prior to the Form finishing Loading but I suppose it could.

    And check your references for the Control since 2013 may have a newer version of the Control for all I know. I suppose it would be a Com object in References or Com namespace or something.


    La vida loca

    Friday, March 30, 2018 7:45 PM
  • Finally i got the solution.............

    The Web Browser Control is - by default - perpetually stuck in IE 7 rendering mode. Even though we're now up to IE 11 and a reasonably HTML5 compatible browser, the Web Browser Control always uses the IE 7 rendering engine by default. This is because the original versions of the ActiveX control used this mode and for backwards compatibility the Control continues this outdated and very HTML5 unfriendly default.

    This applies whether you’re using the Web Browser control in a WPF application, a WinForms app using the ActiveX control. Behind the scenes all these UI platforms use the same COM interfaces and so you’re stuck with those same rules.

    The good news is there are a couple of ways to override the default rendering behavior:

    • Using the IE X-UA-Compatible Meta header
    • Using Application specific FEATURE_BROWSER_EMULATION Registry Keys

    HTML fix;

    <!DOCTYPE html> 
    <html> 
      <head> 
        <meta http-equiv="X-UA-Compatible" content="IE=edge" /> 
        ... other headers
      </head>
      <body>
        ... content
      </body>
    </html>  

    Via registry;

    Go to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\MAIN\FeatureControl\FEATURE_BROWSER_EMULATION for 64-bit or 32-bit only machines.

    Or go to HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\MAIN\FeatureControl\FEATURE_BROWSER_EMULATION for 32-bit on 64-bit systems (It cannot hurt to add keys to both locations if you have them. If you do not have them, you can make the folders yourself).

    Create a new DWORD key and name it the name of your application e.g. "myapp.exe" and then edit the value of the key. There are many different values you can add depending on the IE version you want to emulate. I entered 11001 (as a decimal value - 0x2AF9 in HEX) which emulates IE 11 (many more values located at: http://msdn.microsoft.com/en-us/library/ee330730%28v=vs.85%29.aspx#browser_emulation).

    If you're using Visual Studio like I am, you'll notice that this method might not even work. However, it does work. You need to manually open the .exe file using Explorer or terminal rather than run the project on Visual Studio.

    If you wish to run the program on Visual Studio then consider adding a key for "myapp.vshost.exe" as this is used for debugging.

    I hope this helps anyone with any issue regarding your Web Browser perhaps using the wrong IE version as a wrapper or functions are not working as intended.


    • Marked as answer by general2000 Monday, April 2, 2018 5:32 PM
    • Edited by general2000 Monday, April 2, 2018 5:38 PM
    Monday, April 2, 2018 5:32 PM
  • I'm glad that fixed it general2000 and great effort on your part. I've seen what you've done before however I did not realize that one project in one era of Visual Studio (older version) would all the sudden require this in a newer era of Visual Studio (newer version). Therefore I couldn't fathom this being the issue and therefore it is nice to know that. Thanks.

    La vida loca

    Tuesday, April 3, 2018 11:17 PM