Skip to content

iframe 呈现受限内容的考虑 #42

@hax

Description

@hax

iframe 的(不太)新的属性 sandbox 可以用于呈现受限内容。默认情况下会视iframe内容在独立的origin中并禁用脚本、禁止插件、禁止各种有潜在风险的api。

根据 caniuse,除了 IE9- ,其他浏览器都支持。

IE6+ 可使用私有属性 security=restricted作为替代。


另外为了避免多一次请求,可使用 srcdoc 属性。但 IE/Edge 不支持该属性,并且无法用 data url(IE8+ 不支持用 data url 构造 html),但或可用 javascript url。

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions