Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8">
- <title>Google Maps example</title>
- <script type="text/javascript" src="https://maps.google.com/maps/api/js?key=AIzaSyDDuGt0E5IEGkcE6ZfrKfUtE9Ko_de66pA"></script>
- <script>
- if("geolocation" in navigator) {
- navigator.geolocation.getCurrentPosition(function(position) {
- var latlng = new google.maps.LatLng(position.coords.latitude,position.coords.longitude);
- var myOptions = {
- zoom: 8,
- center: latlng,
- mapTypeId: google.maps.MapTypeId.TERRAIN,
- disableDefaultUI: true
- }
- var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
- });
- } else {
- var para = document.createElement('p');
- para.textContent = 'Argh, no geolocation!';
- document.body.appendChild(para);
- }
- </script>
- <style>
- #map_canvas {
- width: 600px;
- height: 600px;
- }
- </style>
- </head>
- <body>
- <h1>Simple maps example</h1>
- <div id="map_canvas"></div>
- </body>
- </html>
Add Comment
Please, Sign In to add comment