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

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidEdge MobileFirefox for AndroidOpera for AndroidiOS SafariSamsung Internet
Basic supportChrome Full support 5Edge Full support YesFirefox Full support 3.5IE Full support 9Opera Full support 16
Full support 16
No support 10.6 — 15
Safari Full support 5WebView Android Full support YesChrome Android Full support YesEdge Mobile Full support YesFirefox Android Full support 4Opera Android Full support 10.6Safari iOS Full support YesSamsung Internet Android ?
Secure context onlyChrome Full support 47Edge ? Firefox Full support 55IE No support NoOpera Full support YesSafari Full support YesWebView Android ? Chrome Android Full support 47Edge Mobile ? Firefox Android Full support 55Opera Android Full support YesSafari iOS Full support YesSamsung Internet Android ?

Legend

Full support  
Full support
No support  
No support
Compatibility unknown  
Compatibility unknown

See also

Document Tags and Contributors

Last updated by: connorshea,