image: html plug-ins
Plug-ins make HTML-kit very flexible, and help you write in a range of script languages
R E L A T E D   C O N T E N T
ADVERTISEMENT

Hands on: Frames and coding

Why framesets are so bad, and how you can code quickly without errors

Nigel Whitfield, Personal Computer World 21 Jun 2007
ADVERTISEMENT

In the last column, I made a passing reference to framesets as a navigational tool and suggested they can cause a ‘collective shudder’.

It’s a comment that a number of readers, including John Shore and Roger Bickerton, wrote to ask about.

What’s the problem with them, and is there a particular reason why they’re not terribly good? And why is CSS any better when it’s so plainly beset by problems with compatibility between browsers?

Framing the problem
First, let’s look at the problem with framesets. Typically, they’re used to divide the screen into a number of sections so that navigation information can be present all the time in one area, while others change according to the options selected. Each frame has a name, and each link can specify the frame in which the page it references is opened.

So, for example, you might have a menu down the left-hand side, and each link opens a new page in the right-hand panel. Links within the right-hand panel might let you move around the content in that frame, while those in the left take you to a different section of the site.

But what happens when you press the Back button on your browser? Many people will expect the main content area of the browser to go back to the information it contained previously. However, often that’s not what happens.

Instead, even though you might have gone through several links on the framed site, you could find that clicking the Back button on your browser takes you back to the last site you visited. This is because the main browser window, which the Back button is concerned with navigating, has always contained the same document – the frameset itself.

That’s not the only problem. Framesets can make it difficult for people to link directly to information within your site. The address they’ll typically see in the location bar on their browser will be the frameset address, not the reference to the content they’re reading in the main part of the screen. They can click to open that in a new window and note the URL, but it’s not very elegant. Also, if they go directly to that URL, they won’t see all the navigation for the rest of your site, since they won’t have loaded the frameset.

You can code around that, adding something to each page so that if it’s not referred to by your menu frame for example, the site’s top page is reloaded, but it’s a lot of hassle. And what if you want to have security for some parts of your site? With only the main page in the location bar, users may become confused about whether or not they’re viewing a secure page.

Finally, there’s the mental gymnastics – making sure that everything works properly, with each link targeting the right frame. This process isn’t too complex when you have just two frames, but can be a problem with any more. As you can only change one at a time, when you want to update both – or even more – you have to open a new frameset document, which will need to load appropriate content for all the frames.

See also:

We solve an unusual hyperlink problem and help you with Windows Update  16 Apr 2007
image: search box screenshotHow to create a professional-looking, user-friendly web-based search function in Perl  07 Mar 2007

All Online
Tags: Web Development

Like this story? Spread the news by clicking below:

Post this to Delicious del.icio.us    Post this to Digg Digg this    Post this to reddit reddit!

Permalink for this story
R E A D E R   C O M M E N T S
M A R K E T P L A C E
Get your free demo of Numara Track-It! 8 - the leading help desk solution for IT related issues.
Make presentations, review documents & share your entire desktop. 30-day free trial! (cc required).
Discover how remote support can fuel your IT business in ways you've never thought of before.
Apply ITIL best practices at your service desk while eliminating integration cost. Learn more here.
WAN based, automated, daily vulnerability assessments. Click here to try and request our whitepapers.
Have your product or service listed here >   
Sponsored links
F E A T U R E D   J O B S
Colindale (C1905), United Kingdom | NHS Blood and Transplant
 Operations Engineer, £28,313 - £37,326 pa plus High Cost Area Supplement, Colindale (C1905) About us The National Blood Service is an integral and vital part of the NHS. Our two million volunteer donors contribute 1.6 ... more >
London, Waterloo, United Kingdom | Christian Aid
Senior Web Designer, £37,526 - £42,257 per annum, London, Waterloo The Senior Web Designer is a crucial post in the Publishing Team and provides creative design and graphic resource for all Christian Aid's websites, with ... more >
Chichester, United Kingdom | West Sussex County Council
  Testing Manager, Chichester, £42,222 - £45,090 (includes a Market Supplement, subject to review) The IT Testing function has until recently been performed within the project structure.  This new role recognises that we need to ... more >
United Kingdom | London School of Economics and Political Science
  London School of Economics and Political Science The Library Analyst Programmer (fixed term 24 months) Salary: £30,201 - £36,563 pa incl The Library is at the heart of LSE, one of the world's greatest ... more >
More job opportunities