Are iframes a terrible idea?(iframe 是一个糟糕的主意吗?)
问题描述
我正在构建一个小部件,并且一直在使用 iframe 来呈现其中的内容.在某个时候,我可能会开始提供第三方 HTML 和 JS,所以我认为 iframe 会是一个好主意.
I'm building a widget, and I've been using iframes to present content within it. At some point, I might start serving third party HTML and JS, so I thought iframes would be a good idea.
它确实使小部件 javascript 稍微复杂了一点,我担心这可能不是最好的实现.
It does make the widget javascript a little more complicated, and I'm concerned that this might not be the best implementation.
你有什么建议吗?了解其他人对 iframe 的看法会很有帮助.
Do you have any advice? It would be a huge help to hear what other people think about iframes.
推荐答案
不,iframe 没有问题.如果您要开始提供第三方内容,iframe 可能是一个更好的主意.
No, nothing wrong with iframes. Iframes are probably a better idea if you're going to start serving third party content.
即将发布的 HTML5 规范还计划在 iframe 中针对此类情况构建更多安全功能,因此我认为现在也使用它们是一种好习惯.
The upcoming HTML5 spec also plans to build more security features into iframes for situations like this, so I would consider it good practice to use them now also.
这篇关于iframe 是一个糟糕的主意吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:iframe 是一个糟糕的主意吗?


- CSS媒体查询(最大高度)不起作用,但为什么? 2022-01-01
- 如何使用 JSON 格式的 jQuery AJAX 从 .cfm 页面输出查 2022-01-01
- Css:将嵌套元素定位在父元素边界之外一点 2022-09-07
- Fetch API 如何获取响应体? 2022-01-01
- Quasar 2+Apollo:错误:找不到ID为默认的Apollo客户端。如果您在组件设置之外,请使用ProvideApolloClient() 2022-01-01
- 400或500级别的HTTP响应 2022-01-01
- Flexslider 箭头未正确显示 2022-01-01
- 使用RSelum从网站(报纸档案)中抓取多个网页 2022-09-06
- 失败的 Canvas 360 jquery 插件 2022-01-01
- addEventListener 在 IE 11 中不起作用 2022-01-01