Google maps API directions service redirects to JSON info, but how do I get it to open map app in phone?

I’m new to Google Map API. The following javascript opens a new page with the JSON data. The google documentation gives the following URL example, (I added the javascript part). But there isn’t a complete example anywhere that I found.

I’m trying to open this from my website, into open the google maps app on a phone to the places indicated. Of course, the places will be put in programmically.

function myNavFunc4(){",IL&destination=Los+Angeles,CA&waypoints=Joplin,MO|Oklahoma+City,OK&key=My_KEY");


Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

In order to launch Google Maps app from your website you can use the Google Maps URLs. This API was designed for this purpose.

Instead of using Directions API web service endpoint in your script you should create a Google Maps URL for directions.


function myNavFunc4(){",IL&destination=Los+Angeles,CA&waypoints=Joplin,MO|Oklahoma+City,OK");

For further details please have a look at Google Maps URLs documentation.


All methods was sourced from or, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Notify of

Inline Feedbacks
View all comments
Would love your thoughts, please comment.x