Navigator:geolocation 属性
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
Navigator.geolocation
只读属性返回 Geolocation
对象,该对象允许 Web 内容访问设备的位置。这允许网站或应用程序根据用户的位置提供定制化的结果。
备注: 出于安全考虑,当网页请求获取用户位置信息时,用户会被提示进行授权。注意,不同浏览器在请求权限时有不同的策略和方式。
值
一个 Geolocation
对象。
规范
Specification |
---|
Geolocation # dom-navigator-geolocation |
浏览器兼容性
Report problems with this compatibility data on GitHubdesktop | mobile | server | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
geolocation | ||||||||||||||
Secure context required |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
- No support
- No support
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.