-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex-new.html
More file actions
39 lines (34 loc) · 1.21 KB
/
Copy pathindex-new.html
File metadata and controls
39 lines (34 loc) · 1.21 KB
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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>jQuery Mobile Docs - Buttons</title>
<link rel="stylesheet" href="css/jquery.mobile-1.0.1.min.css" />
<script src="js/jquery-1.7.1.js"></script>
<script src="js/jquery.mobile-1.0.1.js"></script>
<script type="text/javascript">
$(document).ready(function(){
console.log(navigator.geolocation.getCurrentPosition);
if ( navigator.geolocation )
{
var timeoutVal = 10 * 1000 * 1000;
navigator.geolocation.getCurrentPosition(handlePosition, displayError, { enableHighAccuracy: true, timeout: timeoutVal, maximumAge: 0 });
}
else {
setMessage("Geolocation is not supported by this browser", "Geolocation is not supported by this browser");
}
});
function handlePosition(pos)
{
alert("Your location is: " + pos.coords.latitude + ', ' + pos.coords.longitude);
}
function displayError(error)
{
var errors = { 1: 'Permission denied', 2: 'Position unavailable', 3: 'Request timeout' };
alert("Error occured: " + errors[error.code], "Error occured: " + errors[error.code]);
}
</script>
</head>
<body></body>
</html>