Question

I am trying to create a facebook app with a google apps script application inside it. for example,

my google script address is https://script.google.com/macros/s/ABCDEFGHIJKLMNOPQRSDUVWXYZ/exec , which I can access by web browser without problems.

Inside the script, I've designed both doGet() and doPost() with simple HTML output return:

function doGet(request){
  Logger.log("[GET]");
  Logger.log(request);
  return HtmlService.createHtmlOutput(<html><head></head><body>Hello World</body></html>);
}

function doPost(request){
  Logger.log("[POST]");
  Logger.log(request);
  return HtmlService.createHtmlOutput(<html><head></head><body>Hello World</body></html>);
}

and set my fabebook app canvas url to

"http://script.google.com/macros/s/ABCDEFGHIJKLMNOPQRSDUVWXYZ/exec?" and "https://script.google.com/macros/s/ABCDEFGHIJKLMNOPQRSDUVWXYZ/exec?"

But facebook app page responsed nothing. In my google script logger, apparently it has been access by method POST:

[13-07-06 15:46:19:641 HKT] [POST]
[13-07-06 15:46:19:647 HKT] {queryString=null, postData=FileUpload, parameter=
{signed_request=
ABwQlxIQ8qCMleUj1oomKszLWeKclO56lya5uOfdizA.eyJhbGdvcml0aG0iOiJITUFDLVNIQTI1NiIsImlzc3VlZF9hdCI6MTM3MzA5Njc3OCwidXNlciI6eyJjb3VudHJ5IjoidHciLCJsb2NhbGUiOiJ6aF9UVyIsImFnZSI6eyJtaW4iOjIxfX19
},contextPath=, parameters={signed_request=
[ABwQlxIQ8qCMleUj1oomKszLWeKclO56lya5uOfdizA.eyJhbGdvcml0aG0iOiJITUFDLVNIQTI1NiIsImlzc3VlZF9hdCI6MTM3MzA5Njc3OCwidXNlciI6eyJjb3VudHJ5IjoidHciLCJsb2NhbGUiOiJ6aF9UVyIsImFnZSI6eyJtaW4iOjIxfX19]
}, contentLength=203}

I have also tried ContentService, UiApp but still failed.

Was it helpful?

Solution

It is not possible to embed Google App Script in another page. App script page adds x-frame-origin header which makes it not possible to embed.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top