Simple clear advice in plain English

Hands on: Frames and coding

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

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.

Reader Comments

   

Add your comment

All fields must be completed. Your email address will not be displayed or used to send marketing messages.

All messages will be checked by moderators before appearing on the site.

See our Privacy Policy for more information.

Related articles

Hands on: Simple templates with Perl

How to create a professional-looking, user-friendly web-based search function in Perl

Hands on: Hyperactive hyperlinks

We solve an unusual hyperlink problem and help you with Windows Update

Blog illustration

Create a Wordpress blog

Blogs are a great way to share news and opinions online. In the first article in our two-part series, we show you how to set one up and update it

Question & Answer

Q.How do I store musician and other information about...

> Read the answer

Q.Why can't my browser find the website address I typed...

> Read the answer

Q.All updates have been downloaded, so why won't Windows...

> Read the answer

Best deals on the web

img

THREE E585 Mi-Fi Take it Away Mobile Broadband - 5GB allowance

£44.97- Buy it now

img

T-MOBILE 3G Pay As You Go iPad Micro SIM

£0.10- Buy it now

img

THREE Huawei E353u Take It Away Mobile Broadband - One Month Rolling Contract

£4.99- Buy it now

Great benefits for subscribers!

Poll

Which is your preferred web browser

Jargon Buster

Computing terms explained in plain English

CAD

Computer Aided Design. Software used to create 3D models.

Great shopping deals from Computeractive