<%@ page language="java" contentType="text/html; charset=UTF-8"
|
pageEncoding="UTF-8"%>
|
<!DOCTYPE html >
|
|
<html>
|
<head>
|
</head>
|
|
<body>
|
<p>position:</p>
|
<div id="location"></div>
|
<script>
|
window.onload=getLocation;
|
var div=document.getElementById("location");
|
function getLocation()
|
{
|
if (navigator.geolocation)
|
{
|
navigator.geolocation.getCurrentPosition(showPosition);
|
}
|
else{div.innerHTML="Geolocation is not supported by this browser.";}
|
}
|
function showPosition(position)
|
{
|
div.innerHTML="Latitude: " + position.coords.latitude +
|
"<br />Longitude: " + position.coords.longitude;
|
}
|
</script>
|
</body>
|
|
</html>
|