1

I wanted to make a simple google Maps(using a WebBrowser) in my application where you can type an address. At the beginning it was working, but since a few days it tells me that I'm using an incompatible browser for Google Maps. Here is the simple code :

 private void searchData_Click(object sender, EventArgs e)
    {
        string rue = textBoxRue.Text; //address

        // Google Maps
        try
        {
            StringBuilder requete = new StringBuilder();

            requete.Append("http://maps.google.com/maps?z=1&t=m&q=");

            if (rue != string.Empty)
            {
                requete.Append(rue);
            }


            webBrowser1.Navigate(requete.ToString());
        }

        catch
        {
            MessageBox.Show("Erreur lors de l'exécution de la requête");
        }
    }

Does someone have an idea of the problem ?

Alexandre
  • 125
  • 9
  • `catch(Exception e)` and post `e` here. – Sinatr Apr 11 '17 at 14:31
  • "it tells me that I'm using an incompatible browser for Google Maps" ***Specifically***: What is the error message? – spender Apr 11 '17 at 14:32
  • VS and .NET uses Edge browser, try opening it up and visit the same site from there. If you're using older version of Windows it may use IE instead. – mrogal.ski Apr 11 '17 at 14:33
  • 1
    The [docs](https://developers.google.com/maps/documentation/javascript/browsersupport) say maps supports Edge and IE10/11 - what you need to do is [force the webbrowser control to emulate one of the compatible IE versions](http://stackoverflow.com/questions/17922308/use-latest-version-of-internet-explorer-in-the-webbrowser-control) – stuartd Apr 11 '17 at 14:35
  • It doesn't raise the exception by the way. I just have the message " You seem to be using a non-compatible browser Old browsers can compromise your security. In addition, they are slow and are not compatible with the latest features of Google Maps. To access Google Maps, you need to use a recent browser." instead of the Map. What I don't understand is that it was working at the beginning, and it works on any browser if don't use my application. – Alexandre Apr 11 '17 at 14:39

1 Answers1

0

Visual Studio is defaulting to IE7. You can force it to use a newer version by adding a meta tag to the website if you control the website. I assume that isn't the case. Instead, you will have to use RegEdit to add a DWord in the following location on the target machine.

32 Bit: Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION

64 Bit: Computer\HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION

The name of the DWord is the name of your executable, eg. "myprogram.exe" without any path. The value is the version number of IE to emulate plus three zeroes. For IE11 your decimal value would be "11000".

Be aware that this will affect all users. If for some reason you only want to affect the current user you would instead work on HKEY_CURRENT_USER set.

I hope that helps.