From 33058f2b292b3a581333bdfb21b8f671898c5060 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:40:17 -0500 Subject: initial commit --- .../zh-cn/web/api/navigator/geolocation/index.html | 56 ++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 files/zh-cn/web/api/navigator/geolocation/index.html (limited to 'files/zh-cn/web/api/navigator/geolocation') diff --git a/files/zh-cn/web/api/navigator/geolocation/index.html b/files/zh-cn/web/api/navigator/geolocation/index.html new file mode 100644 index 0000000000..89842d99bd --- /dev/null +++ b/files/zh-cn/web/api/navigator/geolocation/index.html @@ -0,0 +1,56 @@ +--- +title: Navigator.geolocation +slug: Web/API/Navigator/geolocation +tags: + - API + - HTTPS + - Navigator + - 参考 + - 地理位置 + - 地理位置 API + - 属性 +translation_of: Web/API/Navigator/geolocation +--- +

{{securecontext_header}}{{APIRef("Geolocation API")}}

+ +

Navigator.geolocation 只读属性返回一个 {{domxref("Geolocation")}} 对象,通过这个对象可以访问到设备的位置信息。使网站或应用可以根据用户的位置提供个性化结果。

+ +
+

注意: 出于安全考虑,当网页请求获取用户位置信息时,用户会被提示进行授权。注意不同浏览器在请求权限时有不同的策略和方式。Windows10在未开启定位的情况下无法获取位置

+
+ +

语法

+ +
geo = navigator.geolocation
+
+ +

标准

+ + + + + + + + + + + + + + + + +
标准状态备注
{{SpecName('Geolocation', '#navi-geo', 'NavigatorGeolocation.geolocation')}}{{Spec2('Geolocation')}}初次定义
+ +

浏览器兼容性

+ + + +

{{ CompatibilityTable() }}

+ +

另请参阅

+ + -- cgit v1.2.3-54-g00ecf