iframe 呈现受限内容的考虑
Open
笔记
- Dominant language
- HTML
- Stars
- 464
- Forks
- 27
- PR merge metrics
- No merged PRs in 30d
Description
iframe 的(不太)新的[属性 sandbox](https://html.spec.whatwg.org/multipage/embedded-content.html#attr-iframe-sandbox) 可以用于呈现受限内容。默认情况下会视iframe内容在独立的origin中并禁用脚本、禁止插件、禁止各种有潜在风险的api。
根据 [caniuse](http://caniuse.com/#feat=iframe-sandbox),除了 IE9- ,其他浏览器都支持。
IE6+ 可使用[私有属性 `security=restricted`](https://msdn.microsoft.com/en-us/library/ms534622(v=vs.85).aspx)作为替代。
----
另外为了避免多一次请求,可使用 `srcdoc` 属性。但 IE/Edge 不支持该属性,并且无法用 data url(IE8+ 不支持用 data url 构造 html),但或可用 javascript url。
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.