title: custom google map in new window
body: <p>I try to finish code mentioned <a href="https://stackoverflow.com/a/7348030/6639518">here</a>.
  But something goes wrong as I am new in java-scripting, My guess is the map simply does not loading properly. DIV is created in new tab, text as well. Please help me to open custom map in new tab.
  Here is the code:</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;title&gt;test&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
    &lt;script&gt;
    function newWindow() {
      var w = window.open('', '_blank'); //you must use predefined window name here for IE.
      var head = w.document.getElementsByTagName('head')[0];
  
      //Give some information about the map:
      w.document.head.innerHTML = '&lt;title&gt;Simple Map&lt;/title&gt;&lt;/head&gt;';
      w.document.body.innerHTML = '&lt;body&gt;&lt;H1&gt;Loading&lt;/H1&gt;&lt;div id="map_canvas" style="display: block; width: 500px; height: 300px; margin: 0; padding: 0;"&gt;&lt;/div&gt;&lt;/body&gt;';
  
      var loadScript = w.document.createElement('script');
      //Link to script that load google maps from hidden elements.
      loadScript.type = "text/javascript";
      loadScript.async = true;
      loadScript.src = "https://maps.googleapis.com/maps/api/js?sensor=false&amp;callback=initialize";
  
      var googleMapScript = w.document.createElement('script');
      //Link to google maps js, use callback=... URL parameter to setup the calling function after google maps load.
      googleMapScript.type = "text/javascript";
      googleMapScript.async = true;
      googleMapScript.text = 'var mapOptions = {center: new google.maps.LatLng(50.4,30.50),zoom: 6, mapTypeId: google.maps.MapTypeId.TERRAIN}; var map = new google.maps.Map(document.getElementById("map_canvas"), mapOptions);';
  
      head.appendChild(loadScript);
      head.appendChild(googleMapScript);
    }
    //addLoadEvent(loadScript);
    &lt;/script&gt;
    &lt;button onclick="newWindow()"&gt;Click me&lt;/button&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>