iframe是否被认为是“坏习惯”? [英] Are iframes considered 'bad practice'?

查看:148
本文介绍了iframe是否被认为是“坏习惯”?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

沿着这条线的某个地方,我认识到使用iframe是'坏习惯'的概念。

这是真的吗?什么是使用它们的优点/缺点?

解决方案

与所有技术一样,它有起起伏伏。如果您使用iframe来绕过正确开发的网站,那当然是不好的做法。不过有时候iframe是可以接受的。

iframe的主要问题之一与书签和导航有关。如果你使用它来简单地在你的内容中嵌入一个页面,我认为这很好。这是一个iframe的用途。



然而,我也看到了滥用iframe的情况。它不应该被用作网站的组成部分,而应该作为网站内容的一部分。



通常情况下,如果你可以在没有iframe的情况下做到这一点,是一个更好的选择。我相信这里的其他人可能有更多的信息或更具体的例子,这一切都归结于你正在努力解决的问题。



就这样说,如果你是仅限于HTML,并且无法访问PHP或ASP.NET等后端,有时iframe是您唯一的选择。


Somewhere along the line I picked up the notion that using iframes is 'bad practice'.

Is this true? What are the pros/cons of using them?

解决方案

As with all technologies, it has its ups and downs. If you are using an iframe to get around a properly developed site, then of course it is bad practice. However sometimes an iframe is acceptable.

One of the main problems with an iframe has to do with bookmarks and navigation. If you are using it to simply embed a page inside your content, I think that is fine. That is what an iframe is for.

However I've seen iframes abused as well. It should never be used as an integral part of your site, but as a piece of content within a site.

Usually, if you can do it without an iframe, that is a better option. I'm sure others here may have more information or more specific examples, it all comes down to the problem you are trying to solve.

With that said, if you are limited to HTML and have no access to a backend like PHP or ASP.NET etc, sometimes an iframe is your only option.

这篇关于iframe是否被认为是“坏习惯”?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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