MDN的例子,本地运行没有打印地理位置,也没有报错,为何?求指导
刚开始PC端一直返回超时,可能是PC端不支持,用手机打开后又提示:error.code 1 PERMISSION_DENIED
手机谷歌浏览器报错:err.code 1,不允许获取地理位置,如何解决?
哪里可以重新打开允许或者js如何修改是否允许?
var options = {
enableHighAccuracy: true,
timeout: 5000,
maximumAge: 0
};
function success(pos) {
var crd = pos.coords;
console.log('Your current position is:');
console.log('Latitude : ' + crd.latitude);
console.log('Longitude: ' + crd.longitude);
console.log('More or less ' + crd.accuracy + ' meters.');
};
function error(err) {
console.warn('ERROR(' + err.code + '): ' + err.message);
};
navigator.geolocation.getCurrentPosition(success, error, options);
navigator.geolocation.getCurrentPosition在谷歌浏览器好像不行,其他浏览器可以,具体原因不清楚