Producing web pages
* HTML CSS DHTML XHTML A to Z of tags        Accessibility          Design

When to use frames (and when not to)

Some useful ways to use frames:

  • If you want a table of contents for your site. You can set up a small column on the left for the contents and put the content itself in a large column on the right. This is useful if you have a lot of information that people may need to browse
  • To compare two documents. You can display pages in two equal sized windows so you can read through both
  • For questions and answers. You can put the question in a small frame at the top and use the bottom frame to display an answer
  • Footnotes and glossary items. Use a small frame at the bottom to explain technical terms

Some irritating ways to use frames:

  • To display static content such or advertisements. It is handy to keep navigation bars and a table of contents on the screen all the time but once you have seen an advert it only takes up space that could have some useful information in it
  • To display another site. If your site has frames that point to another site, all the links in the document on that site will load into your frames. This is easy to do by accident; you forget to use target="top" on the link to the other site

There is some discussion about the current implementation of frames and whether the way they work is a good thing. Lots of people don't like frames and the main objections seem to be:

  • Book marking is hard. Everything on the web has a URL so, in theory, you can link to anything, anywhere. The problem with frames is that although the first document (the one defining the frameset) has a URL, this URL does not change as you move through the pages on the site. There is no way to keep track of where you are and this makes bookmarking difficult
  • It is difficult to print a page or a frame or even know which frame the browser will print. It is easy to print a content list instead of the text you want, For example, Netscape 4.5 allows you to preview what you are going to print but it only prints the last frame you touched not the whole page. Internet Explorer 5 give you options on the print dialogue box to print the page as it appears, the selected frame or all the frames individually
  • Some browsers do not support frames. Frames have no content (they just point to pages); browsers that don't support frames just skip the tags and so have nothing to display. This means you have to do lots of extra work if you want to be sure everyone can look at your site. This should not be much of an issue now because frames are part of the HTML 4.0 specification and both Internet Explorer and Netscape support them
  • Frames looked different in different browsers. What worked well in Netscape could look horrid in Internet Explorer. There were (maybe still are) quite a lot of bugs in the implementation of frames