Frage

If I go to the google maps homepage, there's a button there with my location. If I press it, the browser asks me if I want to share my location with google. I know of the V3 API's google.loader.ClientLocation, but this isn't asking me anything related to location sharing.

War es hilfreich?

Lösung

Check the documentation at http://code.google.com/apis/maps/documentation/javascript/basics.html#Geolocation.

The key piece of code you need to use is:

navigator.geolocation.getCurrentPosition(successCallback);

It can take an errorCallback as an optional second parameter.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top