PositionError 接口表示当定位设备位置时发生错误的原因。
属性
PositionError 接口没有继承任何属性。
- PositionError.code只读
- 返回无符号的、简短的错误码。下列值是可能的:
 值 相关联的常量 描述 1PERMISSION_DENIED地理位置信息的获取失败,因为该页面没有获取地理位置信息的权限。 2POSITION_UNAVAILABLE地理位置获取失败,因为至少有一个内部位置源返回一个内部错误。 3TIMEOUT获取地理位置超时,通过定义 PositionOptions.timeout来设置获取地理位置的超时时长。
- PositionError.message只读
- 返回一个开发者可以理解的 DOMString来描述错误的详细信息。
方法
PositionError 接口没有实现也没有继承任何方法。
标准
| Specification | Status | Comment | 
|---|---|---|
| Geolocation API PositionError | Recommendation | Initial specification. | 
浏览器兼容性
| Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari | 
|---|---|---|---|---|---|
| Basic support | 5 | 3.5 (1.9.1) | 9 | 10.60 Removed in 15.0 Reintroduced in 16.0 | 5 | 
| Feature | Android | Chrome for Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile | 
|---|---|---|---|---|---|---|
| Basic support | ? | ? | 4.0 (4) | ? | 10.60 | ? | 
请参见
- Using geolocation
- The Geolocationinterface that use it.