admin管理员组文章数量:1324837
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:
1) Using a HTML box (Insert --> HTML box)
This return the follow: removing disallowed attribute src on tag iframe
I used the exact same html code that works just fine
<iframe src="#list" width="800" height="600" frameborder="0"></iframe>
2) Using the HTML service (Google Apps Script)
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="#list" width="800" height="600" frameborder="0"></iframe>
</body>
</html>
This only shows the "Hello stackoverflow" and space where the iframe should be.
3) Insert --> More gadgets --> Include Gadget (iframe)
This one works with the same url that I used in the other methods: #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.
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:
1) Using a HTML box (Insert --> HTML box)
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./embeddedfolderview?id=0B9xgK9AXrIuiMS0xNTQ5MzZjNy0xYTAxLTQzMjQtYWVkOS03M2Q3YWQxMzVhN2I#list" width="800" height="600" frameborder="0"></iframe>
2) Using the HTML service (Google Apps Script)
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./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.
3) Insert --> More gadgets --> Include Gadget (iframe)
This one works with the same url that I used in the other methods: https://drive.google./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.
Share Improve this question edited May 23, 2017 at 12:03 CommunityBot 11 silver badge asked Oct 13, 2014 at 11:24 maeqmaeq 1,1032 gold badges12 silver badges24 bronze badges3 Answers
Reset to default 1Try 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./embeddedfolderview?id=XXXXXXXXXX_FOLDERID_XXXXXX#list" width="800" height="600" frameborder="0"></iframe>
</body>
</html>
Deploy as the web app and use "exec" link
Have you tried sandbox and the different modes for HTML service we have?
function doGet() {
return HtmlService.createHtmlOutputFromFile('index').setSandboxMode(HtmlService.SandboxMode.IFRAME);
}
https://developers.google./apps-script/guides/html/restrictions#sandbox_mode
Not sure if this will work, but first access the sharing settings of the folder and make sure "everyone with the link can access".
Then retry doing the Insert > Google Drive
本文标签: javascriptGoogle Sites HTML Iframe (not gadget)Stack Overflow
版权声明:本文标题:javascript - Google Sites HTML Iframe (not gadget) - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742120888a2421689.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论