问题
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.
回答1:
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
Issue Tracker
回答2:
I was able to reproduce this - it seems like the Sites editor strips out the entire query string when you embed a gadget. So this broken during the site editing, not site rendering itself.
Do you know when this changed behavior?
Please report in the info in Issue Tracker.
来源:https://stackoverflow.com/questions/13680195/google-apps-script-gadget-url-parameters-are-ignored-when-embedded-in-a-google-s