This documentation is archived and is not being maintained.
This documentation is archived and is not being maintained.
User Location
Bing
Obtaining a user’s location can easily be done using the W3C Geolocation API. This API is exposed through the navigator.geolocation property in the browser. The browser will display a notification to the user the first time this API tries to get the users location, and ask permission to share this data. The geolocation class has the following static methods.
Attempts to obtain the users location. If successful it will trigger the callback function. This callback will receive a Position object that contains coordinates of the user and possibly additional information such as accuracy speed, heading, altitude.
Monitors the users position and triggers the callback if the user location information changes. This method will return a number which is the ID of this task. It can be used to clear/stop this task.
clearWatch(watchId:number)
Clears/stops a watch position task with the specified ID.
This tells the browser that it would like to receive the best possible results. This may result in slower response times or increased power consumption. Default is false.
timeout
number
The maximum length of time (expressed in milliseconds) that is allowed to pass from the call until the corresponding successCallback is invoked. Default is Infinity.
maximumAge
number
Indicates that the application is willing to accept a cached position whose age is no greater than the specified time in milliseconds. Default is 0.