Get user GPS location on basic map on page load

2 posts / 0 new
Last post
todosmqdev
Get user GPS location on basic map on page load

How do I fire the location call by default on a new map?

I'm using this default map:

https://developer.mapquest.com/documentation/mapquest-js/v1.3/examples/b...

But I want the geolocate function to call when the page is initially loaded and place the user's location on the map, just like when they press the "GPS Locate" button on the map.

Is there a way to fire this by default instead of waiting for the user to hit the button?

I also want to combine this functionality with the following map:

https://developer.mapquest.com/documentation/tools/latitude-longitude-fi...

But I can't find the code to use from that Lat/Long Finder page.  Is there sample code somewhere?

Thanks.


MQBrianCoakley
You can use the JavaScript
You can use the JavaScript Navigator.geolocation object to find the user's location on page load.