Open Google map with specific address in a browser

JavascriptHtmlGoogle MapsHref

Javascript Problem Overview


What is the url structure to search for an address in Google Maps?

I want to offer an address on my website that, when clicked, it will open google maps directly to an address from my script.

I want to create a link <a href="..."></a> which will open a Google Maps browser page that shows a map of a street address from my script.

Javascript Solutions


Solution 1 - Javascript

You can do it like this:

this is your href: http://maps.google.com/?q= everything that goes after q will be filled in the search filled and submitted, for example: 1200 Pennsylvania Ave SE, Washington, District of Columbia, 20003

So the link looks like this: <a href="http://maps.google.com/?q=1200 Pennsylvania Ave SE, Washington, District of Columbia, 20003">...</a>

If you need the "q" to be dynamic you can do it with simple jQuery code to update your href.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionURL87View Question on Stackoverflow
Solution 1 - JavascriptYakovView Answer on Stackoverflow