Create a template HTML in Google Apps Script and display it in doGet.Is it possible to specify the URL of the script in iframe and view it from other sites?
index.html
<html>
<body>
<?
varsite=sitesApp.getPageByUrl("https://sites.google.com/...");
varcontents=site.getHtmlContent();
output.append(contents);
?>
</body>
</html>
code.gs
function doGet(){
varhtml=HtmlService.createTemplateFromFile("index");
return html.evaluate;
}
I don't think I can do it at the moment.
X-Frame-Options can be used to prevent web pages from being embedded in iframes on other sites.
If you try to create and access HTML services, you will see the response header
X-Frame-Options:SAMEORIGIN
was included, the app script seems to have various security considerations, and it is also restricted.
There may be conditional permission eventually, and there may already be a way to remove the restriction, but the document does not seem to mention it.
You can embed it in Google Sites, so you want me to do it with that.
Note:
You can remove the X-Frame-Options
restrictions on sites created by Google Sites in the Google Sites.
Therefore, the Google Sites page itself can be embedded in pages in other domains with iframe.
However, the HTML service embedded in it is still X-Frame-Options:SAMEORIGIN
.
The reason why it can be embedded in Google Sites is because HTML services embedded in Google Sites are delivered from the sites.google.com domain, not from script.google.com.
This avoids restrictions on X-Frame-Options:SAMEORIGIN
.
This causes the Google Sites portion to appear in the "Google Sites with HTML Services embedded page" and the HTML Services portion to not appear in it.
(These circumstances change from hour to hour, so I don't know how long this will last.Just in case)
567 rails db:create error: Could not find mysql2-0.5.4 in any of the sources
610 Uncaught (inpromise) Error on Electron: An object could not be cloned
577 PHP ssh2_scp_send fails to send files as intended
599 GDB gets version error when attempting to debug with the Presense SDK (IDE)
887 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
© 2024 OneMinuteCode. All rights reserved.