Leaflet/debug/map/geolocation.html

35 lines
1009 B
HTML
Raw Normal View History

2012-03-18 03:19:56 +08:00
<!DOCTYPE html>
<html>
<head>
<title>Leaflet geolocation debug page</title>
<link rel="stylesheet" href="../../dist/leaflet.css" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="../css/screen.css" />
<script type="text/javascript" src="../../build/deps.js"></script>
2012-03-18 03:19:56 +08:00
<script src="../leaflet-include.js"></script>
</head>
<body>
<div id="map"></div>
<script type="text/javascript">
2014-03-04 23:54:41 +08:00
var osmUrl = 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
2014-03-05 00:04:00 +08:00
osmAttrib = '&copy; <a href="http://openstreetmap.org/copyright">OpenStreetMap</a> contributors',
osm = L.tileLayer(osmUrl, {maxZoom: 18, attribution: osmAttrib});
2012-03-18 03:19:56 +08:00
2014-03-04 23:54:41 +08:00
var map = new L.Map('map', {zoom: 15, layers: [osm]});
2012-03-18 03:19:56 +08:00
function logEvent(e) { console.log(e.type); }
map.on('locationerror', logEvent);
map.on('locationfound', logEvent);
map.locate({setView: true});
</script>
</body>
</html>