问题描述
我正在构建一个小部件,我一直在使用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是一个糟糕的主意吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!