With Chrome, this HTML5 code works fine by itself and with JQuery Mobile, but in my application that uses JQUery Mobile and Nokia HTML5 map, it times out (error code=3).
With Firefox and IE it works fine in all cases. Also as noted in a separate thread, the "Get current position" icon is not displayed on the map in Chrome.
Is there any reason why it shouldn't work in Chrome?Code:function get_current_location(){ if(navigator.geolocation){ // timeout at 60000 milliseconds (60 seconds) var options = {timeout:10000, enableHighAccuracy:false}; navigator.geolocation.getCurrentPosition(showLocation, errorHandler, options); //track_position(); }else{ alert("Sorry, browser does not support geolocation!"); } } function showLocation(position) { var latitude = position.coords.latitude; var longitude = position.coords.longitude; alert("Latitude : " + latitude + " Longitude: " + longitude); } function errorHandler(err) { // 0: unknown error // 1: permission denied // 2: position unavailable (error response from locaton provider) // 3: timed out if(err.code == 0) alert("Unknown error while getting current location!"); else if(err.code == 1) alert("Access is denied while getting current location!"); else if( err.code == 2) alert("Error: Position is unavailable!"); else if( err.code == 3) alert("Error: Timed out while getting current location!"); }
Is there another way to do this?
Thanks
Tom

Reply With Quote


