Integrate Google Maps into .NET Windows Forms


Integrating google maps on a .NET application may be tricky if you want a fast and easy implementation without using APIs. As you may already know, the fastest way to do this is to use a WebBrowser. But what you do when there are compatibility rendering problems? In my case, google returned “You seem to be using an unsupported browser.“.  Please note that this fix can be applied for any other website.

The error you may face with may looks like (this is a windows form created in c# which integrates webBrowser):

google maps error

For a better index:

You seem to be using an unsupported browser.
Old browsers can put your security at risk, are slow and don’t work with newer Google Maps features. To access Google Maps, you’ll need to update to a modern browser.

Learn more

What cause this error?

By default, .NET WebBrowser uses Internet Explorer 7 to render pages. This browser is no longer supported by Google Maps and a lot of websites. This is the reason why Google Maps service push that error!

How to solve this error?

To do this we have to fool google that we are using another browser in other to get a basic functionality of their service!

To do this, we gonna change the user agent, directly inside Navigate() method as the follows:


string latitude = "50.052282";
string longitude="14.462447";
string url = "" + latitude + "," + longitude;
webBrowser1.Navigate(url, null, null, "User-Agent: rullz!");

!!! Don’t expect to be a perfect fix! Some functionalities may not work as expected but at least you will get the main content, as the following:

google maps .net error

google maps .net error

As you can there is showed up only naked map and the indicator which tell exactly where the coordinates are! Simple and beautiful!

Full implementation:

Beginner and webBrowser1 doesn’t exists?

Drag and drop WebBrowser from Toolbox inside visual studio to your form:


And yeah, you gonna face with annoying alerts, don’t forget to add this to your form, to hide the errors:

webBrowser1.ScriptErrorsSuppressed = true;

That’s all!

This is a fast and unprofessional way to get what you want!

Now you have google maps integrated into your C#/F#/Do#/FaMajor/CBemol/ReMinor application!

Please note that there are other ways to solve this in a better way! But if you don’t want to rummage through registry and through API documentation use this fix!

I am also in a hurry and the article may not be the best but if you know what you are looking for you may find it usefully!

Got something to say? Go for it!