我使用的是html5地理位置 我是从文档中做出的
getLocation() {
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(this.showPosition, this.showError);
} else {
alert("geolocation not support");
}
},
代码正常工作,如果我使用chrome(toogle设备工具栏) 但在移动浏览器中chrome(android)safari(ios)显示错误
用户未共享位置
如何解决?
启用手机地理位置
UPD:很可能是因为没有ssl证书?
答案 0 :(得分:2)
并非所有浏览器都内置了相同的API。因此,您必须弄清楚客户端使用的浏览器,并根据所包含的API编写不同的代码。您可以通过检查用户代理来确定他们使用的浏览器。
答案 1 :(得分:1)
答案 2 :(得分:0)
在https://whatwebcando.today/上检查哪些浏览器支持它。另外,可能会在操作系统设置中禁用地理位置服务-整个或每个应用程序。