aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/api/geolocationpositionerror/index.html
blob: 82d72a55d857da6b2c0bef7bb262fe6fa0bbf25a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
---
title: PositionError
slug: Web/API/GeolocationPositionError
tags:
  - API
  - Geolocation API
translation_of: Web/API/GeolocationPositionError
---
<p>{{APIRef("Geolocation API")}}</p>

<p><strong><code>PositionError</code></strong> 接口表示当定位设备位置时发生错误的原因。</p>

<h2 id="属性">属性</h2>

<p><em><code>PositionError</code> 接口没有继承任何属性。</em></p>

<dl>
 <dt>{{domxref("PositionError.code")}} {{readonlyInline}}</dt>
 <dd>返回无符号的、简短的错误码。下列值是可能的:
 <table class="standard-table">
  <tbody>
   <tr>
    <th scope="col"></th>
    <th scope="col">相关联的常量</th>
    <th scope="col">描述</th>
   </tr>
   <tr>
    <td><code>1</code></td>
    <td><code>PERMISSION_DENIED</code></td>
    <td>地理位置信息的获取失败,因为该页面没有获取地理位置信息的权限。</td>
   </tr>
   <tr>
    <td><code>2</code></td>
    <td><code>POSITION_UNAVAILABLE</code></td>
    <td>
     <p>地理位置获取失败,因为至少有一个内部位置源返回一个内部错误。</p>
    </td>
   </tr>
   <tr>
    <td><code>3</code></td>
    <td><code>TIMEOUT</code></td>
    <td>
     <p>获取地理位置超时,通过定义{{domxref("PositionOptions.timeout")}} 来设置获取地理位置的超时时长。</p>
    </td>
   </tr>
  </tbody>
 </table>
 </dd>
 <dt>{{domxref("PositionError.message")}} {{readonlyInline}}</dt>
 <dd>返回一个开发者可以理解的 {{domxref("DOMString")}} 来描述错误的详细信息。</dd>
</dl>

<h2 id="方法">方法</h2>

<p><em><em><code>PositionError</code> 接口没有实现也没有<em>继承任何方法。</em></em></em></p>

<h2 id="标准">标准</h2>

<table class="standard-table">
 <thead>
  <tr>
   <th scope="col">Specification</th>
   <th scope="col">Status</th>
   <th scope="col">Comment</th>
  </tr>
 </thead>
 <tbody>
  <tr>
   <td>{{SpecName('Geolocation', '#positionerror', 'PositionError')}}</td>
   <td>{{Spec2('Geolocation')}}</td>
   <td>Initial specification.</td>
  </tr>
 </tbody>
</table>

<h2 id="浏览器兼容性">浏览器兼容性</h2>

{{Compat("api.GeolocationPositionError")}}

<h2 id="请参见">请参见</h2>

<ul>
 <li><a href="/en-US/docs/WebAPI/Using_geolocation" title="/en-US/docs/WebAPI/Using_geolocation">Using geolocation</a></li>
 <li>The {{domxref("Geolocation")}} interface that use it.</li>
</ul>