fs-danaus
2022-08-05 4a551fc73bd4c86f43aa68c0aab8d1dbeae46836
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<%@ 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>