This should give you the error you are looking for. It doesn't work on my chrome win 7 and the error is user permission denied when running locally, but not when uploaded to a server. Might try getting this onto a server instead of running with the file:/// protocol. Should do the trick. Chrome is pesky about what it allows when running locally.
$(document).ready(function(){
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(showPosition, showError);
function showPosition(position) {
var currentLatitude = position.coords.latitude;
var currentLongitude = position.coords.longitude;
alert(currentLongitude);
localStorage.DeviceLocation=currentLatitude+","+currentLongitude;
$("#curr_loc_target").html("<b>Current location enabled as target </b> <BR> <b>Latitude :</b> "+currentLatitude.toFixed(5)+" <b>Longitude : </b>"+currentLongitude.toFixed(5));
$("#curr_loc_target").show();
}
} else {
alert("geoloc not working");
}
function showError(error) {
var x = $('#curr_loc_target');
switch(error.code) {
case error.PERMISSION_DENIED:
x.html("User denied the request for Geolocation.");
break;
case error.POSITION_UNAVAILABLE:
x.html("Location information is unavailable.");
break;
case error.TIMEOUT:
x.html("The request to get user location timed out.");
break;
case error.UNKNOWN_ERROR:
x.html("An unknown error occurred.");
break;
}
}
});