function requestGeoLocation() {
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(function(loc){
// do nothing
//document.getElementById('myloc').innerHTML = 'Location: ' +
// loc.coords.latitude + ', ' +
// loc.coords.longitude;
}, function() { alert('request denied or something went wrong.');});
} else {
alert('GPS is supported.');
}
A expert on system architect with full SDLC and Agile development experience. Skills: , C# C++ Scrum OOA/OOD javascript ASP.Net MVC XML, HTML Web Service, RESTful, WCF, Android and etc. Email me if you need help on development.
Showing posts with label Maps. Show all posts
Showing posts with label Maps. Show all posts
Friday, 27 January 2012
Javascript to request GPS location from web page
There is no direct method natively built in Javascript stack. Don't give up though. I am giving your few lines of code to provide the result you look for. The code runs well on IE9, Chrome, FireFox, Safari on both PC and mobile device platforms.
Subscribe to:
Posts (Atom)