2012-08-27 47 views
0

此页面上的JavaScript代码不会显示地图。有什么建议么?它是否阻止执行的Caja消毒剂? Thankx! Cor谷歌应用脚​​本html服务和加载谷歌地图javascript api V3

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

[使用完整的Google Maps V3 API及其在Google Apps脚本中的所有功能](http://stackoverflow.com/questions/11820188/use-the-full-google-maps-v3-api-和所有功能在谷歌应用程序脚本) –

回答

0

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

+0

这仍然是这种情况?在尝试从HtmlService模板加载地图JS API时获取JS错误,如“无法添加属性地图,对象不可扩展”。 – Emeka

+0

+ Corey G:你的回答差不多两年了,我不得不再问一次。任何有关Google Apps Script支持Google Maps JavaScript API v3的新闻? –

+0

可悲的是我不能说。一年前我离开了Apps Script团队。 –