嵌入Google网站时,Google Apps脚本小工具网址参数会被忽略 [英] Google Apps Script Gadget URL parameters are ignored when embedded in a Google Site
问题描述
我正尝试在Google网站中嵌入一个Apps Script小工具及其网址参数,但呈现的小工具会忽略网址参数。它只能检索Google网站网址参数。
请检查此处。
小工具的Apps脚本代码为
$ b $ pre $ 函数doGet(e){
var app = UiApp .createApplication();
if(e.parameter.page =='hello')app.add(helloPanel_());
else app.add(hiPanel_());
返回应用;
}
函数helloPanel _(){
var app = UiApp.getActiveApplication();
return app.createLabel('你在你好面板');
}
函数hiPanel _(){
var app = UiApp.getActiveApplication();
return app.createLabel('你在嗨面板');
}
这个功能用于更早的工作,直到Google Apps脚本小工具网址被重新命名有一个新的结构。
我想知道这是预期的功能还是错误?如果有错误,我会报告问题跟踪器。
解决方法是从应用程序脚本URL本身传递参数嵌入Google协作平台)
更改网址使其看起来像这样:
https://sites.google.com/macros/exec?service=Th3Fr3ak1nGL0NgIDg00g1eCr3aT3s¶m=1
I am trying to embed an Apps Script gadget with its URL parameters in a Google Site but the rendered gadget ignores the URL parameters. It can retrieve only Google-site-url parameters. Please check it here.
Apps Script code for the Gadget is
function doGet(e){
var app = UiApp.createApplication();
if(e.parameter.page == 'hello') app.add(helloPanel_());
else app.add(hiPanel_());
return app;
}
function helloPanel_(){
var app = UiApp.getActiveApplication();
return app.createLabel('You are at hello panel');
}
function hiPanel_(){
var app = UiApp.getActiveApplication();
return app.createLabel('You are at hi panel');
}
This used to work earlier until the Google Apps Script Gadget URLs were re-branded with a new structure.
I want to know if this is intended functionality or is it a bug? If a bug, I'll report it Issue tracker.
A workaround to pass the parameters from the apps script URL itself (Google Sites embed)
Change the URL to make it look something like this: https://sites.google.com/macros/exec?service=Th3Fr3ak1nGL0NgIDg00g1eCr3aT3s¶m=1
这篇关于嵌入Google网站时,Google Apps脚本小工具网址参数会被忽略的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!