The new HTML specification, version 5, is great! There is a host of new things to explore including embedded video, SVG, Canvas element (more on that later!) and… Geolocation services! I would like to give you a small demonstration of the API.
Remember to support NZB Completion Checker – Sign up to Astraweb via this banner 🙂
[sourcecode language=”javascript”]
<script type="text/javascript" language="javascript">
if(navigator.geolocation)
{
navigator.geolocation.getCurrentPosition(function(position){
yourposition(position.coords.latitude, position.coords.longitude);
});
}
else
{
alert("geolocation is not supported in your browser!");
}
function yourposition(latitude, longitude)
{
alert(latitude+","+longitude);
}
</script>
[/sourcecode]
If you copy the outputted coordinates into Google maps, it should hopefully show your current location on the map.
[ad name=”Google Adsense-1″]
For more infomation on the Geolocation API and more examples, please go to W3C
Working example
Please click here to try it out! Beware, the geolocation lookup might take a few seconds to complete!
‘:- I am really thankful to this topic because it really gives up to date information .”-