iframe 是一个糟糕的主意吗? [英] Are iframes a terrible idea?

查看:26
本文介绍了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 是一个糟糕的主意吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆