开发者

Is there a way to know source of navigator.geolocation coords?

Is it possible to de开发者_StackOverflow中文版termine wether navigator.geolocation coords are from a GPS or generated some other way?


No.

However, you could check the .coords.accuracy attribute to find out if it's likely to be GPS or something else (like nearby WLANs).

Edit: According to https://developer.mozilla.org/en/Using_geolocation at least Firefox does not provide this attribute. So in this case you are out of luck.

Edit 2: According to the firebug console the attribute is actually available. On my work PC which does not have wireless, it's 25000 for example.

accuracy | double | The accuracy of position information, in meters. Read only.

So the value makes sense, when testing on Google maps the position in my case was not very accurate.

Conclusion:

If finding out if the location is accurate or not is sufficient for you, go with accuracy. Otherwise you are out of luck.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜