Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<html>
  <head>
    <meta name="viewport" content="initial-scale=1.0, user-scalable=no">
    <meta charset="utf-8">
    <title>Load Maps API dynamically</title>
    <style>
      html, body, #map-canvas {
        height: 100%;
        margin: 0px;
        padding: 0px
      }
    </style>
    
    <script>
    var map;
    function initialize() {
        var c = new google.maps.LatLng(54.8867537,-1.557352);
        var mapOptions = {
            zoom:7,
            center: c
        };
        map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions);
    }
     
    function loadScript() {
        var script = document.createElement('script');
        script.type = 'text/javascript';
        script.src = 'https://maps.googleapis.com/maps/api/js?v=3' +
            '&signed_in=true&callback=initialize';
        document.body.appendChild(script);
    }
    window.onload = loadScript;  
    </script>
  </head>
  <body>
    <div id="map-canvas"></div>
  </body>
</html>
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
andreyh13pro
0viewers