2

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.

Waqar Ahmad
  • 3,716
  • 1
  • 16
  • 27
  • Hi, I hope you will help me .. i am stuck in app script..please check this question..http://stackoverflow.com/questions/35620893/how-to-use-angularjs-within-google-apps-script – Debug Diva Feb 25 '16 at 08:26

2 Answers2

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

thasanty
  • 21
  • 4
0

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.

Arun Nagarajan
  • 5,547
  • 1
  • 22
  • 19
  • Thanks for your attention. It was working fine until the URL structure was like https://sites.google.com/macros/exec?service=AKfycby4ASRIVz4Sznn_nOpU3h-qoVNPv-OO77Q , but that time, script was not able to get the parameters of site url. Also, Google Site Gadgets query string is not stripped out because you can still see the parameters in page source when rendered in browser. You may check it here. https://sites.google.com/site/appsdatepicker/home – Waqar Ahmad Dec 03 '12 at 15:39
  • Thanks, I have reported the issue in issue tracker. http://code.google.com/p/google-apps-script-issues/issues/detail?id=2148 – Waqar Ahmad Dec 03 '12 at 15:50