src/main/resources/public/geolocation.js
//check if geolocation is supported. If supported, create map
check if geolocation is supported. If supported, create map
check if geolocation is supported . If supported create map
function geoSetup() {
  if (!navigator.geolocation) {
    alert(
      "Your device does not support geolocation! This page will not work properly!"
    );
  } else {
    id = navigator.geolocation.getCurrentPosition(success, error);
  }
  function success(position) {
    latitude = position.coords.latitude;
    longitude = position.coords.longitude;
    createMap(); 
  }
  function error() {
    console.log("fail to retrieve location");
  }
}
function geoSetup ( ) { if ( ! navigator . geolocation ) { alert ( "Your device does not support geolocation! This page will not work properly!" ) ; } else { id = navigator . geolocation . getCurrentPosition ( success , error ) ; } function success ( position ) { latitude = position . coords . latitude ; longitude = position . coords . longitude ; createMap ( ) ; } function error ( ) { console . log ( "fail to retrieve location" ) ; } }
check if geolocation is supported.
check if geolocation is supported .
//check if geolocation is supported // id = navigator.geolocation.watchPosition(success, error, option); //update position, will probably use this in final version //success for getting position in geolocation //if successful create the map //error in getting position for geolocation