地理定位浏览器 API 用于检测访问者位置的方法的顺序是什么?
在 W3C 地理定位信息网站上,它说它使用 IP、Wi-Fi、手机和 GPS 的组合,但没有说明执行此操作的顺序。
据我了解,它使用 GPS(如果可用),然后使用其他 3 种方法之一,但尚不清楚接下来使用哪种方法。
我在一个项目中需要这个,我必须在不使用 IP 的情况下确定用户位置。
最佳答案
API 无法获取用户的位置;它从浏览器请求它(我相信浏览器从操作系统获取它 - 但如果我错了请纠正我)。确切的方法取决于可用的硬件,并且原始数据无法通过 API 访问。来自 this Google 开发者页面:
The API is device-agnostic; it doesn't care how the browser determines location, so long as clients can request and receive location data in a standard way. The underlying mechanism might be via GPS, wifi, or simply asking the user to enter their location manually.
关于javascript - 浏览器地理定位API验证顺序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38683751/