Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/google-apps-script/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Google apps script 在表单提交事件-谷歌应用程序脚本上打开URL_Google Apps Script_Google Forms - Fatal编程技术网

Google apps script 在表单提交事件-谷歌应用程序脚本上打开URL

Google apps script 在表单提交事件-谷歌应用程序脚本上打开URL,google-apps-script,google-forms,Google Apps Script,Google Forms,我使用Serge insas提供的示例代码,可在此处找到: 我稍微修改了代码,如下所示: 代码.GS function modalUrl(){ FormApp.getUi() .showModalDialog( HtmlService.createHtmlOutputFromFile('openUrl').setHeight(50), 'Opening StackOverflow' ) } openU

我使用Serge insas提供的示例代码,可在此处找到:

我稍微修改了代码,如下所示:

代码.GS

   function modalUrl(){
      FormApp.getUi()
       .showModalDialog(
         HtmlService.createHtmlOutputFromFile('openUrl').setHeight(50),
         'Opening StackOverflow'
       )
    } 
openURL.html

<!DOCTYPE html>
<html>
  <head>
   <base target="_blank">
    <script>
     var url1 ='https://stackoverflow.com/a/54675103';
     var winRef = window.open(url1);
     winRef ? google.script.host.close() : window.alert('Allow popup to redirect you to '+url1) ;
     window.onload=function(){document.getElementById('url').href = url1;}
    </script>
  </head>
  <body>
    Kindly allow pop ups</br>
    Or <a id='url'>Click here </a>to continue!!!
  </body>
</html>

var url1='1〕https://stackoverflow.com/a/54675103';
var winRef=window.open(url1);
winRef?google.script.host.close():window.alert('允许弹出窗口将您重定向到'+url1');
window.onload=function(){document.getElementById('url')。href=url1;}
请允许弹出窗口

如有关课程的文件中所述:

脚本只能与当前实例的UI交互 打开编辑器,并且仅当脚本是绑定到编辑器的容器时


对于Google表单,编辑器是在您编辑特定表单时使用的,而不是在您填写表单时使用的。如果表单未嵌入网站,则提交表单后无法自动重定向用户,这可能是本支持中的解决方法可以帮助您的。

如有关类的文档中所述:

脚本只能与当前实例的UI交互 打开编辑器,并且仅当脚本是绑定到编辑器的容器时


对于Google表单,编辑器是在您编辑特定表单时使用的,而不是在您填写表单时使用的。如果表单未嵌入网站,则提交表单后无法自动重定向用户,这可能是此支持中的解决方法可以帮助您。

如错误所述,您无法做到这一点。用户需要点击编辑器中的菜单来打开弹出窗口。这很不幸,但感谢您的确认。正如错误所说,您不能这样做。用户需要点击编辑器中的菜单打开弹出窗口。这很不幸,但感谢您的确认。