我创建了一个表单,它将表单字段数据上传到 Google 表格并将文件上传到 Google 云端硬盘。现在,提交后,页面将重定向到一个新页面,显示“文件已成功上传到谷歌驱动器网址”。
我想重定向到特定的 URL。我该怎么做?
!!更新7/20!!我已按照下面 Jonas W 的建议更新了代码。然而,检查调试器后,出现以下错误:
关于如何解决 X-Frame-Options 有什么建议吗?
这是我的文件上传函数末尾的当前重定向代码:
return "File uploaded successfully" + file.getUrl();
以html文件的形式调用文件上传函数:
<input type="submit" value="Submit"
onclick="this.value='Uploading..';
google.script.run.withSuccessHandler(fileUploaded)
.uploadFiles(this.parentNode);
return false;" style="margin-top: 20px">
这是来自表单 html 文件的 fileUploaded 代码:
<script>
function fileUploaded(status){
window.location="http://centerforalternativefuels.org";
}
</script>
最佳答案
<script>
function fileUploaded(status){
window.location="http://newurl";
}
</script>
关于javascript - 提交使用 Google 脚本构建的 HTML 表单后如何重定向到 URL?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38492829/