Secure context
This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.
The Navigator.geolocation read-only property returns a Geolocation object that gives Web content access to the location of the device. This allows a Web site or app to offer customized results based on the user's location.
Note: For security reasons, when a web page tries to access location information, the user is notified and asked to grant permission. Be aware that each browser has its own policies and methods for requesting this permission.
Syntax
geo = navigator.geolocation
Specifications
| Specification | Status | Comment |
|---|---|---|
| Geolocation API The definition of 'Navigator.geolocation' in that specification. |
Recommendation | Initial definition |
Browser compatibility
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Update compatibility data on GitHub
| Desktop | Mobile | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Basic support | Chrome Full support 5 | Edge Full support Yes | Firefox Full support 3.5 | IE Full support 9 | Opera
Full support
16
| Safari Full support 5 | WebView Android Full support Yes | Chrome Android Full support Yes | Edge Mobile Full support Yes | Firefox Android Full support 4 | Opera Android Full support 10.6 | Safari iOS Full support Yes | Samsung Internet Android ? |
| Secure context only | Chrome Full support 47 | Edge ? | Firefox Full support 55 | IE No support No | Opera Full support Yes | Safari Full support Yes | WebView Android ? | Chrome Android Full support 47 | Edge Mobile ? | Firefox Android Full support 55 | Opera Android Full support Yes | Safari iOS Full support Yes | Samsung Internet Android ? |
Legend
- Full support
- Full support
- No support
- No support
- Compatibility unknown
- Compatibility unknown
See also
Document Tags and Contributors
Tags:
Contributors to this page:
connorshea,
chrisdavidmills,
abbycar,
cdignam,
RogerDSwearingenSr,
Sebastianz,
Dan-Dascalescu,
teoli,
kscarfone,
Sheppy,
Jeremie
Last updated by:
connorshea,