Browser Geolocation Test

Shows browser is slept or not by taking note of the number of positions provided.

by Nathaniel Layton

HTML

<input type='text' id='Count' value='0' />

JavaScript

var options = { enableHighAccuracy: true, maximumAge: 100, timeout: 60000 };
if( navigator.geolocation) {
   var watchId = navigator.geolocation.watchPosition( positionChanged, err, options );
   var timeout = setTimeout( function() { navigator.geolocation.clearWatch( watchId ); }, 45000 );
} else {
   err();
}
function err(){
	alert('error');
}
function positionChanged(pos){
	console.log(pos.coords.latitude + ', ' + pos.coords.longitude);
    var el = document.getElementById('Count');
    el.value = (el.value*1)+1;
}