在布局中使用 iframe?

发布于 2024-11-15 04:16:26 字数 296 浏览 6 评论 0原文

我真的想要一种方法来拥有一个文件,例如导航栏和页脚,这样我就不必浏览所有页面(只有 20 个左右,但无论如何......)来更新它。所以我意识到框架(iframe?有什么区别)可以帮助我解决这个问题。

此外,我听说很多地方由于某种原因框架在网页设计中是禁忌。这与 SEO 有关吗?

我可以安全地使用 (i) 框架吗?是否有保留网址 http://www.domain.tld/pagename.html 的替代方法?

I really want a way to have one single file for, for example, the navigation bar and the footer so that I don't have to go through all of my pages (only 20 or so, but anyway...) to update it. So I've realized that frames (iframes? What's the difference) can help me with this.

Additionally, I've heard a lot of places that frames are a no-go in web design for some reason. Is this to do with SEO?

Can I use (i)frames safely? Are there alternatives that keep the url http://www.domain.tld/pagename.html ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

蓝海似她心 2024-11-22 04:16:26

无论您做什么,都不要使用框架/iframe 进行页面布局。

最好的选择是使用服务器端脚本语言来构建页面。这样,您可以将各个组件放在单独的文件中(这使得维护变得容易),然后使用脚本语言组合它们。

Whatever you do, don't use frames/iframes for page layout.

Your best bet is to use a server-side scripting language to build your page. That way, you can have the individual components in separate files (which makes maintenance easy) and then compose them using the scripting language.

带上头具痛哭 2024-11-22 04:16:26

所以我意识到框架(iframe?有什么区别)

iframe 将文档嵌入到页面中间。

框架是框架集的一部分,框架集由整个页面组成。

可以帮我解决这个问题。

它们可以,但有很多缺点(搞乱链接、打印、导致滚动问题等)。使用包含(例如 phpssi)或模板系统(例如模板工具包的ttree) 代替。

So I've realized that frames (iframes? What's the difference)

An iframe embeds a document in the middle of a page.

A frame is part of a frameset, which consists of an entire page.

can help me with this.

They could, but have plenty of drawbacks (mucking up linking, printing, causing scrolling issues, etc). Use an include (e.g. php or ssi) or template system (e.g. template toolkit's ttree) instead.

心头的小情儿 2024-11-22 04:16:26

添加到这些 两个很好的答案,来自从 SEO 的角度来看,基于框架的网站也可能是一个坏主意。

Google 支持框架和 iframe
可以的程度。镜框可以
给搜索引擎带来问题
因为它们不对应于
网络的概念模型。在这个
模型,一页只显示一个URL。
使用框架或 iframe 的页面
显示多个 URL(每个 URL 一个)
框架)在单个页面内。谷歌
尝试将框架内容与
包含框架的页面,但我们
不保证我们会。

请参阅此内容

作为旁注,你考虑过301重定向吗?它并不完全保留相同的地址,而是相反,但如果我理解您的担忧,这可能就是您想要的。

Adding to these two good answers, from the SEO point of view a frame based site is also might be a bad idea.

Google supports frames and iframes to
the extent that it can. Frames can
cause problems for search engines
because they don't correspond to the
conceptual model of the web. In this
model, one page displays only one URL.
Pages that use frames or iframes
display several URLs (one for each
frame) within a single page. Google
tries to associate framed content with
the page containing the frames, but we
don't guarantee that we will.

See this

As a side note, have yo considered 301 redirect? It is not precisely keeping the same address, rather the opposite but it might be what you want if I understood your concern.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文