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.
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