admin管理员组文章数量:1426225
I'm used html5 geolocation I made from the documentation
getLocation() {
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(this.showPosition, this.showError);
} else {
alert("geolocation not support");
}
},
code working if i'm using chrome (toogle device toolbar) but in mobile browsers chrome(android) safari(ios) showing error
User did not share location
how to fix it ?
On phones geolocation enabled
UPD: Most likely this is due to the fact that there is no ssl certificate ?
I'm used html5 geolocation I made from the documentation
getLocation() {
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(this.showPosition, this.showError);
} else {
alert("geolocation not support");
}
},
code working if i'm using chrome (toogle device toolbar) but in mobile browsers chrome(android) safari(ios) showing error
User did not share location
how to fix it ?
On phones geolocation enabled
Share Improve this question edited Apr 26, 2017 at 15:37 Rai asked Apr 25, 2017 at 15:55 RaiRai 1935 silver badges15 bronze badgesUPD: Most likely this is due to the fact that there is no ssl certificate ?
2 Answers
Reset to default 2Not all browsers have the same APIs built in. So you will have to figure out what browser a client is using and write different code depending on what APIs are included. You can figure out what browser they are using by checking the user agent.
With the latest browser updates to get geolocation, you need to use the
SSL certificates
for safari browser answer from this question helped me
本文标签: javascriptHow to access geolocation in mobile web browserStack Overflow
版权声明:本文标题:javascript - How to access geolocation in mobile web browser - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745457062a2659150.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论