问题
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>
回答1:
No Google APIs are supported by HtmlService/Caja yet. We are working hard on making that pass sanitization.
来源:https://stackoverflow.com/questions/12138360/google-apps-script-html-service-and-loading-the-google-maps-javascript-api-v3