小编str*_*ato的帖子

提交旧的Google表单然后重定向到另一个页面

我在网页上使用Google表单.我将表单中的源代码直接复制到我的页面上,这样我就可以修改一些HTML而不是使用iframe.然后,我不想将用户带到google docs响应页面,而是将其重定向到另一个页面.

我遇到的麻烦是页面重定向.我能够通过以下方式在Chrome和Firefox中正常运行:

<form target="GoogleResponse" action="https://docs.google.com/spreadsheet/
formResponse?formkey=xxxxxxxxxxxxxxxxxxxxxxxxxx&amp;ifq;" onsubmit="
window.location = 'targetPage.html';" method="POST" id="ss-form">
Run Code Online (Sandbox Code Playgroud)

IE和Safari都自动进行重定向,并且响应从未写入Google表单.如果我放弃重定向,则该操作在两者中都能完美运行,并且响应会记录在Google电子表格中.

所以我试图将操作拉出来,而不是在onsubmit中完成所有操作,就像这样:

<form target="GoogleResponse" onsubmit="this.action = https://docs.google.com
/spreadsheet/formResponse?formkey=xxxxxxxxxxxxxxxxxxxxxxxxxx&amp;ifq'; 
window.location = 'targetPage.html';" method="POST" id="ss-form">
Run Code Online (Sandbox Code Playgroud)

与以前相同的问题,IE和Safari都重定向,并且没有任何内容写入Google电子表格.再次,如果我删除重定向,响应将记录在所有浏览器中.我还可以做其他事情,比如在行动后投入警报,一切都继续正常.我唯一看到问题的方法是重定向.

所以在这一点上我唯一可以想到的是,它们是重定向和动作之间的某种冲突.我对javascript和表单的工作知识非常有限,所以任何帮助或建议将不胜感激!

html javascript google-sheets google-forms

12
推荐指数
1
解决办法
9017
查看次数

标签 统计

google-forms ×1

google-sheets ×1

html ×1

javascript ×1