[英]geolocation using html5
Hi i am using html5 geolocation to get user current location.it's working fine with all the desktop browsers except safari . 嗨,我正在使用html5地理位置来获取用户当前位置。它与safari之外的所有桌面浏览器都能正常工作。 it's also working with iphone and ipad ,all the android devices except samsung tablet .
它还可以与iphone和ipad一起使用,除了三星平板电脑以外的所有android设备。 it's inter into error callback instead of successcallback.
它是错误回调而不是成功回调的一部分。 can i have some free javascript library which i can use as fallback for this device for usa users.
我可以有一些免费的JavaScript库吗,可以用作美国用户使用的该设备的后备设备。 i know maxmind library but it's response is not so much accurate.if any one have idea than please let me know about that.
我知道maxmind库,但是它的响应不是很准确。如果有人有想法,请让我知道。 if u have any better idea to overcome this situation tan let me know .
如果您有更好的办法克服这种情况,请让我知道。 thanx
谢谢
heres the javascript i used for my site which works on every browser i can find in the office. 这是我在网站上使用的JavaScript,可在办公室中找到的每种浏览器上使用。
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(function (position) {
latitude = position.coords.latitude;
longitude = position.coords.longitude;
//call your function that responds to lat & long
}, // next function is the error callback
function (error) {
switch (error.code) {
case error.TIMEOUT:
alert("Timeout");
break;
case error.POSITION_UNAVAILABLE:
alert("Position unavailable");
break;
case error.PERMISSION_DENIED:
alert("Permission denied");
break;
case error.UNKNOWN_ERROR:
alert("Unknown error");
break;
}
}
);
}
With the error checking in that code you should be able to diagnose what the error is from there. 通过该代码中的错误检查,您应该能够诊断出那里的错误。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.