iFrame 中的 App Script HTMLService App [英] App Script HTMLService App in iFrame

查看:30
本文介绍了iFrame 中的 App Script HTMLService App的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在 iframe 中嵌入 HTMLService 应用程序?

嵌入式示例:http://jsbin.com/axesex/1/edit

该应用程序可以嵌入到 Google 站点中,但不能嵌入到任何其他标准网页中.控制台抛出错误...

<块引用>

拒绝显示https://script.google.com/a/macros/netpremacy.com/s/AKfycbxITmxBMsHIh_u82tbvfICzNesEUJh2MRe7izyDE9cgvaLPCZI/exec' 因为它将'X-Frame-Options'设置为'SAMEORIGIN'.

如果您需要更多信息,请告诉我.

解决方案

2017 年 3 月 24 日更新

是的,但您需要在输出上设置一个额外的标志以允许它被 IFRAME:

//提供没有 X-Frame-Options 标头的 HTML(在 Apps 脚本服务器端代码中).var output = HtmlService.createHtmlOutput('<b>Hello, world!</b>');output.setXFrameOptionsMode(HtmlService.XFrameOptionsMode.ALLOWALL);

Is is possible to embed a HTMLService app in an iframe?

Embedded Example: http://jsbin.com/axesex/1/edit

The app can be embedded within Google Site but not into any other standard web page. The console throw the error...

Refused to display 'https://script.google.com/a/macros/netpremacy.com/s/AKfycbxITmxBMsHIh_u82tbvfICzNesEUJh2MRe7izyDE9cgvaLPCZI/exec' in a frame because it set 'X-Frame-Options' to 'SAMEORIGIN'.

If you need any more information please let me know.

解决方案

Updated 3/24/2017

Yes, but you need to set an extra flag on your output to allow it to be IFRAMEd:

// Serve HTML with no X-Frame-Options header (in Apps Script server-side code).
var output = HtmlService.createHtmlOutput('<b>Hello, world!</b>');
output.setXFrameOptionsMode(HtmlService.XFrameOptionsMode.ALLOWALL);

这篇关于iFrame 中的 App Script HTMLService App的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆