简体   繁体   English

Google Apps脚本HTML服务和加载Google Maps JavaScript API V3

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

This javascript code on the page won't show the map. 页面上的此javascript代码不会显示地图。 any suggestions? 有什么建议么? Is it the Caja sanitizer thats blocking the execution? 是Caja消毒剂阻止了执行吗? Thankx! 谢谢! Cor 肺心病

    <!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>

No Google APIs are supported by HtmlService/Caja yet. HtmlService / Caja尚不支持Google API。 We are working hard on making that pass sanitization. 我们正在努力通过消毒。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM