In GAS, I want to place HTML content inside tabs like what is described here.
I built a working prototype in this jsFiddle. (Since the code is HTML, it does not render properly in this question, otherwise I would have included it. So just navigate to the jsFiddle to view. It is also on the index.html file on the GAS project here.)
However, when I migrated the jsFiddle to my GAS project here, it stopped working. (Again, see the index.html file in GAS.)
You can see the GAS project’s output by clicking here. Note the tabs no longer work as they do in the jsFiddle version.
The problem appears to be that the resource on line 47 of the index.html file does not load.
Checking your Chrome developer tools, notice the console error:
Uncaught In strict mode code, functions can only be declared at top level or immediately within another function.
Notice the other console errors:
GET https://static-focus-opensocial.googleusercontent.com/gadgets/proxy?contain…DqEcDcnD&url=https%3A%2F%2Fgetbootstrap.com%2Fdist%2Fjs%2Fbootstrap.min.js 504 (Gateway Timeout) Uncaught Error: not loaded
So there you have it. Is there any way anyone can think of to get the bootstrap.js resource (line 47) to load properly? Or must we resort to “hacks” like the one described here?
Finally had time to fiddle with your code, after some time in the page you get a error from the server stating that the file "bootstrap.min" was denied. So I created a file "bootstrap.html", copied all of its content to this file, surrounded with script tags, included it in the HTML and voilá, it's working.
The list of changes:
in any code.gs
in the mainPage.html
The doGet now must use
createTemplateFromFile
andevaluate()
And an file with all bootstrap surrounded by
script
tags.You don't need to copy the bootstrap JS into a GAS HTML file, it works if you change the URLs you were using to pull in Bootstrap with mainPage.HTML:
and in your code.gs
Here's the app, and here's the script.
P.S. Thanks for the original POST I've now got a nice pretty web app!