Google apps script 在Google Apps脚本中使用完整的Google Maps V3 API及其所有功能
我想将我的Google Maps V3 Web应用程序转换为Google应用程序脚本。如何将完整的Maps V3 API使用/加载到Google Apps脚本HTML文件(GAS Web App)中?普通的标记方法似乎不起作用 我也尝试过谷歌加载器,但没有成功 即使是,但到目前为止没有运气Google apps script 在Google Apps脚本中使用完整的Google Maps V3 API及其所有功能,google-apps-script,Google Apps Script,我想将我的Google Maps V3 Web应用程序转换为Google应用程序脚本。如何将完整的Maps V3 API使用/加载到Google Apps脚本HTML文件(GAS Web App)中?普通的标记方法似乎不起作用 我也尝试过谷歌加载器,但没有成功 即使是,但到目前为止没有运气 这适用于作为web应用程序发布的“独立脚本”。加载程序尚未在HtmlService中工作。可以使用in-Google Apps脚本HtmlService使用Google Maps JavaScript API
这适用于作为web应用程序发布的“独立脚本”。加载程序尚未在HtmlService中工作。可以使用in-Google Apps脚本HtmlService使用Google Maps JavaScript API v3。将以下代码段发布为web应用程序,并在Google开发者控制台中生成公钥,允许
*.googleusercontent.com/*
作为浏览器引用:
function doGet() {
return HtmlService.createHtmlOutputFromFile('ui')
.setSandboxMode(HtmlService.SandboxMode.IFRAME);
}
--ui.html--(来自)
html,正文,#映射画布{高度:100%;边距:0;填充:0;}
函数初始化(){
变量映射选项={
中心:{纬度:-34.397,液化天然气:150.644},
缩放:8
};
var map=new google.maps.map(document.getElementById('map-canvas'),
地图选项);
}
google.maps.event.addDomListener(窗口“加载”,初始化);
这很不幸,因为谷歌应用程序脚本Web应用程序似乎正是我正在寻找的解决方案。关于何时可以从GAS访问全功能Maps API,是否有任何时间表/计划?有解决办法吗?没有解决办法。在不太遥远的将来的某个时候,但我不能保证具体细节。现在的未来比那时更近吗?即使使用本机沙盒,我也无法让这个或其他Google API正常工作。@Fred你有没有弄明白它?我正在尝试将maps JS API加载到应用程序脚本HTML模板中,并出现“对象不可扩展”错误。这也是我遇到的错误。使用googlejsapi试图修改Caja/HtmlService阻止的Google
对象。
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
html, body, #map-canvas { height: 100%; margin: 0; padding: 0;}
</style>
<script type="text/javascript"
src="https://maps.googleapis.com/maps/api/js?key=API_KEY">
</script>
<script type="text/javascript">
function initialize() {
var mapOptions = {
center: { lat: -34.397, lng: 150.644},
zoom: 8
};
var map = new google.maps.Map(document.getElementById('map-canvas'),
mapOptions);
}
google.maps.event.addDomListener(window, 'load', initialize);
</script>
</head>
<body>
<div id="map-canvas"></div>
</body>
</html>