0

I'm trying to load a web app into an iframe in an external html file. I've built and tested the app and it works fine, stand alone. But when I load it into an iframe i get the following error..

"Exception: No HTML file named WebAppBoot was found. (line 2, file "Code")"

I modified the Code.gs to set the XFrameOptionsMode to allow all, like so...

function doGet(e) { return HtmlService.createHtmlOutputFromFile('WebAppBoot'); output.setXFrameOptionsMode(HtmlService.XFrameOptionsMode.ALLOWALL); } 

I still get the same error

I used this tutorial as the starting point for my web app.. Bootstrap Google Web Application Form Take a look at it to see the file structure in the google "Project", its exactly the same as my web app

9
  • I think that in your script, the function is finished at the 1st line of return HtmlService.createHtmlOutputFromFile('WebAppBoot.html');. So output.setXFrameOptionsMode(HtmlService.XFrameOptionsMode.ALLOWALL); is not used. How about this? If you want to use this, when you modify it to function doGet(e) {return HtmlService.createHtmlOutputFromFile('WebAppBoot.html').setXFrameOptionsMode(HtmlService.XFrameOptionsMode.ALLOWALL)}, what result will you obtain? Commented Feb 27, 2021 at 5:55
  • I get the same result. I can't tell if the web app is loading into the iframe or not. It seems like it may be because when i test it in a browser i see a "Google Apps Script" message saying that it can't find the html file that's included in the "Google Project". It looks like the Code.gs file is executing inside of the iframe, otherwise it wouldn't display the error that the app is missing the WebAppBoot.html file. Commented Feb 27, 2021 at 7:16
  • Thank you for replying. I deeply apologize my comment was not useful for your situation. Commented Feb 27, 2021 at 8:14
  • What are the names of the .html files in your Apps script project? Commented Feb 28, 2021 at 1:59
  • In the Apps Script Project there are only two files Code.gs and WebAppBoot.html Commented Feb 28, 2021 at 2:03

2 Answers 2

1

Remove the ; of line 2, and output from line 3

function doGet(e) { return HtmlService.createHtmlOutputFromFile('WebAppBoot') .setXFrameOptionsMode(HtmlService.XFrameOptionsMode.ALLOWALL); } 

then publish again your web app creating a new version (on the version dropdown, select New)

Every time that you made a change to your code that want to see on the /exec web app URL you have to publish again your web creating a new version.

Sign up to request clarification or add additional context in comments.

Comments

0

try this:

function doGet(e) { return HtmlService.createHtmlOutputFromFile('WebAppBoot'); output.setXFrameOptionsMode(HtmlService.XFrameOptionsMode.ALLOWALL); } 

1 Comment

Hey Cooper, I changed 'WebAppBoot.html'..to..'WebAppBoot. But i get the same error message. It seems like the Code.gs script is successfully executing inside of the iframe otherwise it wouldn't display such a specific error - looking for a specific file .."Exception: No HTML file named WebAppBoot was found. (line 2, file "Code")"... Do you think that at least the first half of this mystery is solved? That the script is successfully executing in the iframe?

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.