谷歌应用程序脚本的HTML服务和加载谷歌地图JavaScript API API [英] Google apps script html service and loading the Google maps javascript api V3

查看:128
本文介绍了谷歌应用程序脚本的HTML服务和加载谷歌地图JavaScript API API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

此页面上的JavaScript代码不会显示地图。有什么建议么?它是否阻止执行的Caja消毒剂? Thankx! Cor

This javascript code on the page won't show the map. any suggestions? Is it the Caja sanitizer thats blocking the execution? 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>


推荐答案

HtmlService / Caja尚未支持Google API。我们正在努力实现通过卫生处理。

No Google APIs are supported by HtmlService/Caja yet. We are working hard on making that pass sanitization.

这篇关于谷歌应用程序脚本的HTML服务和加载谷歌地图JavaScript API API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆