开发者

Using iframes in layout?

开发者 https://www.devze.com 2023-03-12 16:33 出处:网络
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\'v

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/page开发者_StackOverflow中文版name.html ?


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.


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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消