If a user has disabled the location feature or if he uses a non geo supported feature.
How to do this programatically? This will get executed,if i enable geo location in my browser ,if i do not enable,i want some other code to get executed.Where i put that other code which will be executed when i do not enable or use non supported browser.
<script type="text/javascript">
var directionDisplay;
var directionsService = new google.maps.DirectionsService();
var map;
function initialize() {
directionsDisplay = new google.maps.DirectionsRenderer();
var chicago = new google.maps.LatLng(41.850033, -87.6500523);
var myOptions = {
zoom:7,
mapTypeId: google.maps.MapTypeId.ROADMAP,
center: chicago
}
map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
directionsDisplay.setMap(map);
}
function calcRoute() {
var start = document.getElementById("start").value;
var end = document.getElementById("end").value;
var request = {
origin:start,
destination:end,
travelMode: google.maps.DirectionsTravelMode.DRIVING
};
directionsService.route(request, function(response, status) {
if (status == google.maps.DirectionsStatus.OK) {
directionsDisplay.setDirections(response);
}
});
}
</script>
</head>
<body onload="initialize()">
<div>
I would use modernizer to sniff out whether the browser supports geolocation and then take the appropriate action.
You can even load shims to give the geolocation functionality to browsers which don’t support it. There are examples in the modernizer documentation section.
e.g.
–Edit