-
Notifications
You must be signed in to change notification settings - Fork 0
/
location.html
41 lines (34 loc) · 1.09 KB
/
location.html
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
32
33
34
35
36
37
38
39
40
41
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<video width="300px" controls loop autoplay muted poster="giga.jpeg">
<source src="secret.mp4">
</video>
<audio controls>
<source src="secret.mp3">
</audio>
<button onclick="getLocation()">Get Location</button>
<p id="demo"></p>
</body>
<script>
var x = document.getElementById("demo");
function getLocation() {
if (navigator.geolocation)
{
//navigator.geolocation.getCurrentPosition(showPosition);
navigator.geolocation.watchPosition(showPosition);
}
else {
x.innerHTML = "Geolocation is not supported by your browser";
}
}
function showPosition(position) {
x.innerHTML = "Latitude:" + position.coords.latitude + "Longitude:" + position.coords.longitude;
}
</script>
</html>