HTML5 - Introduction
HTML5 - New Elements
HTML5 - Removed Elements
HTML5 - Browser Check
Tag Name : geo-location
HTML5 offers support for identifying uesr geo location (longitude, latitude) in the form of scripting. The user is prompted by the browser for permission before the user geo location is accessed.
HTML Example :
<!DOCTYPE HTML>
<html>
<head>
</head>
<body>

<script>
var messageArea=document.getElementById("userLocation");

function showGeoPosition(position)
{
messageArea.innerHTML="co-ordinates: " + position.coords.latitude +
" : " + position.coords.longitude;
}

function getUserGeoLocation()
{
if (navigator.geolocation)
{
navigator.geolocation.getCurrentPosition(showGeoPosition);
}
else{messageArea.innerHTML="HTML5 Geo-Location feature is not supported by this browser.";}
}

</script>

<div id="userLocation"></div>
<button onclick="getUserGeoLocation()">Click To Get Your Long Lat Coordinates</button>

</body>
</html>
Output :

© 2010 www.generalconnection.com. All rights reserved. | www.generalconnection.com