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
Reading, Berkshire, United Kingdom | EDS
Position # 397874 IP Network Administrator Location - Reading Job Description: There is a requirement for an IP network administrator to join the Infrastructure Services operational support team to manage the movement of network resources, ... more >
Telford, Shropshire, United Kingdom | EDS
EDS are currently looking to recruit a PMO Support Analyst to join our Project Management Defence team in Telford, Shropshire. Summary: Within DII Service Management. To perform the PMO function for SM Service Introduction. This ... more >
Reading, Berkshire, United Kingdom | EDS
Position # 395423 Environment Manager Location - Reading, Berkshire Job Description: There is a requirement for an Environmental Manager for the Sandpits environment. This position is to act as the single point of contact for ... more >
London, Haringey, United Kingdom | Haringey Council
PMO Support Officer - Haringey, London - £32,289 - £37,542 pa   Experienced project support officer required by the internal IT services organisation of a London borough council to work within its Programme Management Office ... more >
More job opportunities