我通过Facebook Messenger发送链接到网页,网页步伐包括GPS代码 该代码在chrome中很有用,但在Facebook内部浏览器上却没有。 问题是什么?
function getLocation() {
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(showPosition);
} else {
x.innerHTML = "<!-- Geolocation is not supported by this browser -->";
}
}
function showPosition(position) {
if ( ( Math.abs(position.coords.latitude -<?php echo $lat ?>) >0.0001)|| ( Math.abs(position.coords.longitude -<?php echo $lon ?>) >0.0001)){
window.location = ( "/show/?lat=" + position.coords.latitude +
"&lon=" + position.coords.longitude);
}
}
getLocation();