如何解决当我在 Google 应用程序脚本中运行 GET 请求时,如何在浏览器选项卡打开后自动关闭它
我通过单击指向 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 的评论。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。