Article

Practical Web Design - Frames and Frame Usage Explained

Page: 1 2 3 4 5 6 7 Next

Layers

Layers are somewhat similar to IFrames in concept, though not in execution or even appearance. They are strictly Netscape-only elements, and have never been included in official HTML specifications. Since they aren't supported by newer versions of Netscape/Mozilla, not part of the official HTML specs, and are fading into irrelevance, I won't go into details about their care and feeding here.

Search Engine Placement

Frames cause big problems for search engines. Most search engines, including Google, have problems reading frameset pages. Some of them automatically hunt for "noframes" versions, and if they're not available, the search engine will often settle for indexing just the "master," or frameset, page. Like older browsers, many search engines ignore the instructions on producing the frame. Only information within the noframes tags is read -- information that a frames-capable browser will ignore. Hence the "this site uses frames but your browser doesn't support them" message that you often see in search engine results. You probably don't want the frameset page emphasized on the search engine; worse, you run the risk of having the engine display incomplete or misleading information about your site instead of the carefully crafted positioning message you intended to be shown on the engine listing.

So how do you work around this? <meta> tags included in the frameset page are one solution, but not a very good one, as most major search engines have all but abandoned support for <meta> tags. Still, they're worth adding for the engines and intranets that do still use them.

Note that there's a strong argument that <meta> tags are no longer worth the time it takes to write them; I won't debate that here, but if you want to read more about the issue, check out Search Engine Watch's article, Death of a Meta Tag. The only major search engine to still use <meta> tags is Inktomi, and according to their director of product marketing, they've never given the tags a great deal of weight.

A better way to skin this particular cat is to include useful information in the <noframes> instructions. Put the <noframes> information immediately after the first <frameset> tag, if you want the text to be placed as high as possible on the page. Note that placing the information above the first frameset tag will disable the frame information in some versions of Netscape.

Don't forget to use <body> tags on the frameset page, within the <noframes> tags. Providing your frameset page a title is helpful, even though it won't appear when the page is viewed properly. Search engines do index titles; they are one of the most important elements your pages can have.

Now that you've gotten this far, you've created a page that search engines can see and index properly. Great... so far. What you haven't done yet is give search engine users a page that is within your frameset; they have a page outside the normal frame constraints. This can be particularly troublesome with engines like AltaVista that are "frames-capable." These engines can link to any page within your framed site, and display it by itself, without the benefit of the frameset.

You can easily strand visitors coming straight to a page inside your site if and when it doesn't display inside the frameset you designed. Fortunately, there's a simple answer to this. Just be sure to include a "Home" link at the top or bottom of every page that leads back to the main, frameset page. Make sure you use the target="_top" attribute, like so:

<a href="index.html" target="_top">Home Page</a>

Without this attribute, visitors who click on your "Home" link will see a new set of frames drawn within the main frame; not pretty, and not very user-friendly.

Another solution uses JavaScript to force the frames to be redrawn, but I'll leave that as an exercise for the student to locate and use. There are many different varieties of JavaScript coding that accomplishes this particular task. Often, pages that use JavaScript to deal with frame redrawing also prevent visitors from being able to use the "Back" button in its normal fashion to get back to where they came from. Users have to click twice, very quickly, on the "Back" button before the preceding page gets a chance to throw them back into the frameset, or use the back button's history menu to get out of the frameset.

If you liked this article, share the love:
Print-Friendly Version Suggest an Article