Tuesday, March 3, 2015

Javascript Learning

How to find Geolocation?


function findLocation() {
if(navigator.geolocation)  // check if browser is HTML 5 compatible
navigator.geolocation.getCurrentPosition(showLocation);
}

function showLocation(position) {  // position object will give latitude and longitude information
window.location.href = "https://maps.googleapis.com/maps/api/staticmap?center=" + position.coords.latitude +                                                        "," + position.coords.longitude + "&zoom=13&size=600x300";
}