Google Apps Script Gadget URL parameters are ignored when embedded in a Google Site

痞子三分冷 提交于 2019-12-22 18:38:39

问题


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&param=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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!