0

I have this code to enable the GPS on the unit.

if(navigator.geolocation) {
navigator.geolocation.getCurrentPosition(
    displayPosition,
    displayError,
    { enableHighAccuracy: true, maximumAge: 0 }
);
} else {
alert('Geolocation is not supported by this browser');
}


function displayPosition(position) {
var dc_latlong = new google.maps.LatLng(position.coords.latitude.toFixed(6), position.coords.longitude.toFixed(6));
var gps_accuracy = position.coords.accuracy;

var dc_options = {
    minZoom: 4,
    maxZoom: 20,
    center: dc_latlong,
    mapTypeId: google.maps.MapTypeId.ROADMAP,
    streetViewControl: false
}

var dc_map = new google.maps.Map(document.getElementById('google-maps-distance'), dc_options);

var dc_marker = new google.maps.Marker({
    position: dc_latlong,
    draggable: false,
    map: dc_map
});

var dc_circle = new google.maps.Circle({
    center: dc_latlong,
    radius: gps_accuracy,
    map: dc_map,
    fillColor: '#3333ff',
    fillOpacity: 0.2,
    strokeColor: '#3333ff',
    strokeOpacity: 0.5,
    strokeWeight: 1
});

google.maps.event.trigger(dc_map, 'resize');
dc_map.fitBounds(dc_circle.getBounds());


$('#gps-information').show();
$('#gps-accuracy').html(number_format(gps_accuracy) + ' meters');
}


function displayError(error) {
var errors = { 
    1: 'Permission denied',
    2: 'Position unavailable',
    3: 'Request timeout'
};

alert('Error: ' + errors[error.code]);
}

I wonder now how to disable the GPS on the unit so the website doesn't keep getting visitors position?

Thanks in advance.

Airikr
  • 6,258
  • 15
  • 59
  • 110
  • testing on ios6 by chance? Just in case: http://stackoverflow.com/questions/12503815/ios-6-breaks-geolocation-in-webapps-apple-mobile-web-app-capable – RhinoWalrus Nov 13 '12 at 23:52
  • Na. I don't use any of Apples products. I'm testing my website with this geolocation on my computer – Airikr Nov 13 '12 at 23:58

0 Answers0