Enum XFrameOptionsMode
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
XFrameOptionsMode
一个枚举,表示可用于客户端 HtmlService 脚本的 X-Frame-Options 模式。这些值可从 HtmlService.XFrameOptionsMode 中访问,并通过调用 HtmlOutput.setXFrameOptionsMode(mode) 进行设置。
如需调用枚举,请调用其父类、名称和属性。例如
HtmlService.XFrameOptionsMode.ALLOWALL。
设置 XFrameOptionsMode.ALLOWALL 可让任何网站将相应网页纳入 iframe,因此开发者应自行实施防点击劫持保护措施。
如果脚本未设置 X-Frame-Options 模式,Apps 脚本会默认使用 DEFAULT 模式。
// Serve HTML with no X-Frame-Options header (in Apps Script server-side code).
const output = HtmlService.createHtmlOutput('<b>Hello, world!</b>');
output.setXFrameOptionsMode(HtmlService.XFrameOptionsMode.ALLOWALL);
属性
| 属性 | 类型 | 说明 |
ALLOWALL | Enum | 未设置 X-Frame-Options 标头。这样,任何网站都可以将该网页纳入 iframe,因此开发者应自行实现防点击劫持保护。 |
DEFAULT | Enum | 为 X-Frame-Options 标头设置默认值,该值可保留正常的安全假设。如果脚本未设置 X-Frame-Options 模式,Apps 脚本会使用此模式作为默认模式。 |
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2026-03-06。
[null,null,["最后更新时间 (UTC):2026-03-06。"],[],["`XFrameOptionsMode` is an enum for setting `X-Frame-Options` in client-side HtmlService scripts. Accessed via `HtmlService.XFrameOptionsMode`, it's set using `HtmlOutput.setXFrameOptionsMode(mode)`. `ALLOWALL` removes the `X-Frame-Options` header, enabling any site to iframe the page, necessitating developer-implemented clickjacking protection. `DEFAULT` is the default mode if no mode is specified. The example shows how to set the mode to `ALLOWALL`.\n"]]