问题描述
我通过单击指向 Web 应用程序 URL 的链接来调用带有 GET 请求的 Google Apps 脚本 Web 应用程序,以启动一个函数。
我环顾四周,看到很多建议添加 <script>
标签,但似乎不起作用。我哪里出错了?
Code.gs
function doGet(e) {
var pram = e.parameter.param;
// Run some code based off of the parameter
return HtmlService.createHtmlOutputFromFile('confirmation');
}
HTML 文件
<!DOCTYPE html>
<html>
<head>
<base target="_top">
<script>
function start(){
setTimeout(function(){ window.top.close(); },3000);
}
</script>
</head>
<body onload="start()">
<h2 style="text-align: center;">Your function is being Initiated<br>Please Wait...</h2>
</body>
</html>
解决方法
简而言之,这是无法做到的。请参阅@TheMaster 的评论。