aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/api/navigator/geolocation
diff options
context:
space:
mode:
authorPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
committerPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
commit33058f2b292b3a581333bdfb21b8f671898c5060 (patch)
tree51c3e392513ec574331b2d3f85c394445ea803c6 /files/zh-cn/web/api/navigator/geolocation
parent8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff)
downloadtranslated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz
translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2
translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip
initial commit
Diffstat (limited to 'files/zh-cn/web/api/navigator/geolocation')
-rw-r--r--files/zh-cn/web/api/navigator/geolocation/index.html56
1 files changed, 56 insertions, 0 deletions
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
+---
+<p>{{securecontext_header}}{{APIRef("Geolocation API")}}</p>
+
+<p><strong><code>Navigator.geolocation</code></strong> 只读属性返回一个 {{domxref("Geolocation")}} 对象,通过这个对象可以访问到设备的位置信息。使网站或应用可以根据用户的位置提供个性化结果。</p>
+
+<div class="note">
+<p><strong>注意:</strong> 出于安全考虑,当网页请求获取用户位置信息时,用户会被提示进行授权。注意不同浏览器在请求权限时有不同的策略和方式。Windows10在未开启定位的情况下无法获取位置</p>
+</div>
+
+<h2 id="语法">语法</h2>
+
+<pre class="brush: js"><em>geo</em> = <em>navigator</em>.geolocation
+</pre>
+
+<h2 id="标准">标准</h2>
+
+<table class="standard-table">
+ <thead>
+ <tr>
+ <th scope="col">标准</th>
+ <th scope="col">状态</th>
+ <th scope="col">备注</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>{{SpecName('Geolocation', '#navi-geo', 'NavigatorGeolocation.geolocation')}}</td>
+ <td>{{Spec2('Geolocation')}}</td>
+ <td>初次定义</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="浏览器兼容性">浏览器兼容性</h2>
+
+
+
+<p>{{ CompatibilityTable() }}</p>
+
+<h2 id="另请参阅">另请参阅</h2>
+
+<ul>
+ <li><a href="/zh-CN/docs/WebAPI/Using_geolocation">使用地理位置定位</a></li>
+</ul>