Get the latitude and longitude of the user's position:
The result of x could be:
The geolocation property returns a Geolocation object that can be used to locate the user's position.
Since this can compromise user privacy, the position is not available unless the user approves it.
Note: This property is read-only.
For more information about Gelocation, visit our HTML5 Gelocation Tutorial.
The numbers in the table specify the first browser version that fully supports the property.
Property | |||||
---|---|---|---|---|---|
geolocation | 5.0 | 9.0 | 3.5 | 5.0 | 16.0 |
Note: Geolocation is much more accurate for devices with GPS, like a smartphone.
Return Value: | A reference to the Geolocation object |
---|