跳到主要内容
uencoder

iframe Sandbox

iframe sandbox 属性对嵌入内容施加限制(禁脚本、表单、弹窗、同源),隔离不可信嵌入内容。

用途

安全嵌入第三方内容(广告、不可信页面)限制其能力,防止恶意嵌入攻击。

机制

<iframe sandbox="allow-scripts">:默认所有限制,可选放宽 allow-scripts/allow-same-origin/allow-forms/allow-popups 等。无 allow-same-origin 时嵌入内容视为不同源。

用例

  • 第三方内容安全嵌入
  • 广告隔离
  • iframe 安全

相关工具

参考链接