Google Apps脚本在Google协作平台小工具中重定向 [英] Google Apps Script redirect in google Sites gadget
问题描述
我正在谷歌网站上构建一个Web应用程序。目前我在谷歌脚本中有两种形式,第一种加载电子表格并将其显示为表格,然后当您从表格中选择一行时,该脚本将调用具有GET请求和几个参数的另一个Web App(如? rowIndex = X& columnIndex = ..)。
如果我将第一个表单部署为一个Web应用程序,但是,如果我在我的Google网站网页中将第一个脚本作为Google Apps脚本小工具插入,它似乎嵌入为无法重定向到其他网页/脚本的iframe(它只显示空白iframe)。
b$ b
有没有什么办法可以解决这个问题,而无需将两个脚本合并为一个?
用于重定向我在html中使用javascript
windows.location =secondScriptUrl+?parameters ...
$ c $第二个脚本只是从doGet()函数中生成html。
<$ p $ <$ p
$ b $> p> 函数doGet(e){
return HtmlService.createTemplateFromFile('index')。evaluate();
}
/ p>
< base target =_ top>
添加到html代码并更改javascript重定向:
window.top.location.href = url;
I'm building a web application in google sites. Currently I have two forms in google script, the first one load a Spreadsheet and display it as a table, then when you select a row from the table, the script calls another web App with a GET request and with a few parameters (as ?rowIndex=X&columnIndex=..).
This is working fine if I deploy the first form as a web app. But if I insert the first script as a "Google Apps Script Gadget" in my google sites webpage it seems that is embedded as an Iframe that cannot redirect to other webpages/scripts (it just shows a blank iframe).
Is there any way to solve this without merging both scripts in one?
for the redirect I'm using javascript in the html form.
windows.location="secondScriptUrl"+"?parameters..."
and the second script just generates the html from the doGet() function
function doGet(e) {
return HtmlService.createTemplateFromFile('index').evaluate();
}
I solved it adding:
<base target="_top">
to the html code and changing the javascript redirect:
window.top.location.href = url;
这篇关于Google Apps脚本在Google协作平台小工具中重定向的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!