-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path06_geolocation.html
More file actions
49 lines (45 loc) · 1.4 KB
/
06_geolocation.html
File metadata and controls
49 lines (45 loc) · 1.4 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
40
41
42
43
44
45
46
47
48
49
<!DOCTYPE html>
<html manifest="05_ac.manifest">
<head>
<meta charset="euc-kr" />
<meta name="viewport"
content="width=device-width, initial-scale=1.0,
maximum-scale=1.0, minimum-scale=1.0,
user-scalable=no"/>
<title>HTML5</title>
<script type="text/javascript"
src="http://maps.google.com/maps/api/js?sensor=true"></script>
<script type="text/javascript">
function startPage() {
if (navigator.geolocation){
navigator.geolocation.getCurrentPosition(successCallback,errorCallback);
}
}
function successCallback(position){ //ºñµ¿±â ±¸ÇöÀ» À§ÇØ...Äݹé
var lat = position.coords.latitude;
var lng = position.coords.longitude;
var latlng = new google.maps.LatLng(37.493638,126.983623);
var myOptions = {
zoom: 17,
center: latlng,
mapTypeControl: false,
navigationControlOptions: {style:google.maps.NavigationControlStyle.SMALL},
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var mapView = document.querySelector("#mapView");
var map = new google.maps.Map(mapView, myOptions);
var marker = new google.maps.Marker({
position: latlng,
map: map
});
}
function errorCallback(error){
alert(error.message);
}
</script>
</head>
<body onload="startPage()">
<div id="mapView"
style="position:absolute;left:0px;top:0px;width:100%;height:100%;"></div>
</body>
</html>