On the HTML5 geolocation services get overtime ~ ~ seeking answers

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>geolocation</title>
<meta http-equiv="content-type" content="text/html; charset=gb2312" />
<script src="http://ditu.google.cn/maps?file=api&amp;v=2&amp;key=ABQIAAAAYZ21xusyWC8BXoYuSLqHORRfLhfM31b8Rfwa1teacfmRQ87KJBTuQYSGzbuGeTk0JQVuoXj7UCbnBw&sensor=true" type="text/javascript"></script>
<script type="text/javascript">
var map = null;
//load map
function initialize() {
if (GBrowserIsCompatible()) {
map = new GMap2(document.getElementById('map'));
map.setCenter(new GLatLng(28.175278,112.945279), 13);
map.addControl(new GScaleControl());
map.addControl(new GLargeMapControl());
map.addControl(new GOverviewMapControl());
map.addControl(new GMapTypeControl());
}
}

//show map
function showMap(position) {
document.getElementById('info').innerHTML = 'Your position is longitude latitude:'+position.coords.longitude+': '+position.coords.latitude;
var latlng = new GLatLng(position.coords.latitude, position.coords.longitude);
var marker = new GMarker(latlng);
map.addOverlay(marker);
map.setCenter(latlng);
marker.openInfoWindowHtml('Wang Xiaozhe: you are in the vicinity? There may be a deviation of 500 meters! The reason you'll see');
}

function noAllowed(error){
switch(error.code){
case error.PERMISSION_DENIED:
document.getElementById('info').innerHTML = 'You have to stop the program to access your location, so not on the map marker you in the position, please try again. ';
break;
case error.POSITION_UNAVAILABLE:
document.getElementById('info').innerHTML = 'Sorry, unable to identify your location. ';
break;
case error.TIMEOUT:
document.getElementById('info').innerHTML = 'I'm sorry, acquiring position timeout! Please try again. ';
break;
}
}

//button click
function geoLocation(){
document.getElementById('info').innerHTML = 'Trying to get your position...';
navigator.geolocation.getCurrentPosition(showMap, noAllowed, {maximumAge:30000, timeout:10000});
}

</script>
</head>
<body onload="initialize()" onunload="GUnload()">
<input type="button" value="show location" onclick="geoLocation();" />
<div id="info" style="height:50px; line-height:50px;"></div>
<div id="map" style="width:800px;height:500px;"></div>
</body>
</html>



Always connect timeout... A world of ice and snow. Everybody began to help me this rookie!

Started by Sabrina at February 13, 2016 - 2:30 AM

Dear, try another browser.
This case also appears I started using the Google browser.
A QQ browser, try the next, the location information will appear.
Is the way each browser on getCurrentPosition have different?
And Daniel then paste. . .

Posted by Will at January 08, 2017 - 2:24 AM

You may be a network problem

Posted by Owen at January 11, 2017 - 1:38 AM