簡體   English   中英

Google Apps腳本HTML服務和加載Google Maps JavaScript API V3

[英]Google apps script html service and loading the Google maps javascript api V3

頁面上的此javascript代碼不會顯示地圖。 有什么建議么? 是Caja消毒劑阻止了執行嗎? 謝謝! 肺心病

    <!DOCTYPE html>
    \\To load the APIs. I have found this code on https://developers.google.com/loader/;
    <script type="text/javascript" src="https://www.google.com/jsapi"></script>
    <script type="text/javascript">
   \\next load then specific API module with parameters and Callback
    function loadMaps(){
        google.load("maps", "3",{"callback" : mapsLoaded()}, sensor=false, key="AIzaSyBfB1qRhJJiHGFUNtI87yfTrVLx-C8YYp4");
      }
    </script>
    <script type="text/javascript"> 
      var geocoder;
      var map;
      function mapsLoaded() {
    //this is how far the code is executed;
        alert("br");
        var latlng = new google.maps.LatLng(52.2989, 4.9219);
    //this alert does not show up;
        alert(latlng);
        var mapOptions = {
          zoom: 8,
          center: latlng,
          mapTypeId: google.maps.MapTypeId.ROADMAP
        }
            map = new google.maps.Map(document.getElementById("map_canvas"), mapOptions);
      }

    </script> 

    <body onload="loadMaps()">
      <div id="map_canvas" style="width: 100%; height: 200px;"></div>
    </body> 
    </html>

HtmlService / Caja尚不支持Google API。 我們正在努力通過消毒。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM