I'm trying to embed a google drive folder inside my google site, but this folder will be shown only to some users. That is why I can't use Insert --> Drive --> Folder.
I found at this post stackoverflow that you can show a specift folder using a HTML Iframe and It works perfectly.
Now I'm trying to embed that iframe on my Google Site with no luck. I've tried 3 different ways:
This return the follow: removing disallowed attribute src on tag iframe
I used the exact same html code that works just fine
<iframe src="https://drive.google.com/embeddedfolderview?id=0B9xgK9AXrIuiMS0xNTQ5MzZjNy0xYTAxLTQzMjQtYWVkOS03M2Q3YWQxMzVhN2I#list" width="800" height="600" frameborder="0"></iframe>
I create a Google Script that goes like this:
Code.gs
function doGet() {
return HtmlService.createHtmlOutputFromFile('index');
}
index.html
<html>
<body>
<p>Hello Stackoverflow</p>
<iframe src="https://drive.google.com/embeddedfolderview?id=0B9xgK9AXrIuiMS0xNTQ5MzZjNy0xYTAxLTQzMjQtYWVkOS03M2Q3YWQxMzVhN2I#list" width="800" height="600" frameborder="0"></iframe>
</body>
</html>
This only shows the "Hello stackoverflow" and space where the iframe should be.
This one works with the same url that I used in the other methods: https://drive.google.com/embeddedfolderview?id=0B9xgK9AXrIuiMS0xNTQ5MzZjNy0xYTAxLTQzMjQtYWVkOS03M2Q3YWQxMzVhN2I#list
But this way is useless to me because I need to have control over which users can and can't see the Google Drive folder inside the Google Site.
Notice that it has nothing to do with http or https or the shield button on Google Chrome, because I'm using a https url.
You can embed an entire webpage as an iframe in a new Google site. This will allow you to pull in content from other websites and Google tools like Apps Script, Data Studio, and App Maker, saving you the trouble of duplicating and updating that information on your page.
Add HTML, CSS, or JavaScript code to your site On a computer, open a site in new Google Sites. Embed. You can also add an embed as an entire page.
Go to the Sites page that will contain the new gadget. Open the page for editing. Select Insert > More gadgets. Search for the gadget, select it from the categories on the left, or click Add gadget by URL and paste in the URL to your .
Try below Apps Script code
code.gs
function doGet(e) {
var template = HtmlService.createTemplateFromFile('Index');
return template.evaluate()
.setTitle('Web App Search Page')
.setSandboxMode(HtmlService.SandboxMode.IFRAME)
.addMetaTag('viewport', 'width=device-width, initial-scale=1')
.setXFrameOptionsMode(HtmlService.XFrameOptionsMode.ALLOWALL)
}
Index.html
<!DOCTYPE html>
<html>
<head>
<base target="_top">
</head>
<body>
<iframe src="https://drive.google.com/embeddedfolderview?id=XXXXXXXXXX_FOLDERID_XXXXXX#list" width="800" height="600" frameborder="0"></iframe>
</body>
</html>
Deploy as the web app and use "exec" link
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With