

			Programs in HTML5
6. Program to Find current location using Geolocation.
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Untitled Document</title>
<script type="text/javascript">
	function showPosition(position)
	{
		document.write("Latitude : "+position.coords.latitude);
		document.write("Longitude : "+position.coords.longitude);
	}
	function getLocation()
	{
		if(navigator.geolocation)
		{
			navigator.geolocation.getCurrentPosition(showPosition);
		}
		else
		{
			document.write("Browser not supported");
		}
	}
</script>
</head>
<body>
<button type="button" onClick="getLocation()">Get Location</button>
</body>
</html>
Output :Developed by