runway index

The Virtual World

Tables :: HTML Code :: Linking :: Targets :: Further Info

Chapter Index

Introduction
History
Getting Connected
Browsers
Copyright
Search Engines
HTML
Linking documents
Images
Newsgroups
Tables
Forms
Frames
Graphics Crunching
Page Design
Publishing
Javascript

 

Frames

There are several ways to organise your site, one of the simplest is to create a front page with frames. This allows you to have an index in one small frame, and the main page displayed in a larger frame, both within the confines of the page display. Although there are many good points to the use of frames there are also some downers.

Let us have a look at a typical frame structure, and then discuss the good and bad points, and then we will see how to contruct a page using frames.

A typical frame structure would be where you have your page split into several sections. A typical setup would be where you want to have a logo, with company information on the top of every page, and a site index at the left hand side of every page, and the main contents in a large frame below and to the right of those two frames. Thus you have three sections to your page on-screen.

The problem with all of this is that you now have your main page taking up a much reduced area of the screen. This can be a serious problem for people with 14" monitors and a whole battery of browser icons displayed across the top of the monitor.

It is nice to have the ability to click directly on the site index from any page, but the loss of screen real estate is heavy.

However, if you are keen to pursue this route you will need to construct a page to hold the frame instructions (it will contain nothing else). You then construct pages to be loaded into those frames. So your original page will be quite small. It will be a container into which pages can be poured.

One of the pages on my Runway site contains frames. I used to have the whole site framed, but thought better of it. Now, only one section contains frames. The page which holds these frames contains only the following coding.

HTML>

<HEAD>

<TITLE>Runway to the Web</TITLE>

</HEAD>

<FRAMESET cols="129,*">

<NOFRAMES><BODY>

<P>This page is designed to be viewed by a browser which supports Netscape's Frames extension. This text will be shown by browsers which do not support the Frames extension.</P>

</BODY>

</NOFRAMES>

<FRAME SRC="../site-index.html" name="indexbar" NORESIZE>

<FRAME SRC="../Resources2.html" name="content" frameborder="no" padding=0 spacing=0 framespacing=0 border="no">

</FRAMESET>

</HTML>

As you can see, it doesn't amount to much. What is actually happening here is that we have set up a page with two frames, which are two containers. In the first frame another page is loaded (the page called "site-index.html"). This remains in view no matter what is displayed in the other frame. The other frame starts off by containing the file "Resources2.html".

This means the viewer can click on any item in the site index, and the relevant page will be displayed in the second frame, displacing "Resources2.html" or whatever other page happens to be there.

There are a great many advantages to this system. You can click on a link in the original page and it can lead to another page from a different site being loaded into the frame. You will notice that when this happens the title in the browser titlebar does not change, it is as if the viewer remains on the home site indefinitely. This is good for the home site. You are giving the viewer the illusion that all the material he or she wants is available on your site, and they don't have to leave to obtain whatever they want. This is good for promotional purposes.

However, there is a downside to this. If your viewers don't seem to be able to escape from your site, likewise the search engines' robots can't get in. This means that if you have a frameset at the front end of your site, there will be many of the search engines that will not be able to get beyond that first page. This means that all the goodies you have in the various sections of your site will effectively be out of sight of the search engines, and therefore will not figure in the results of the average viewer's search on keywords. In other words virtually all of your site will be relegated to the darkest regions of the web.

My advice is not to have a framed first page to your site. Only put in frames when you find you cannot cope with navigation in any other way, and when you know it will not prejudice the visibility of your pages with regard to the search engines.

Using tables

One of the ways in which you can put an index on screen is by using tables. Look at the way I have used the left hand column of the table I have used to set the contents of these chapters. The main text is set in the second column, the first column is reserved solely for the index. This means I have to have the same index copied and pasted into each chapter of this book. That is a nuisance. There is a lot of redundancy in the coding, but ultimately it all takes up less space, and causes less problems with the site. It is a matter of balancing the pros against the cons, sometimes the pros of having frames will win out, other times, the cons will win. But think it through carefully.

Also worth remembering is that if you put in frames you will have to think about whether to have separate scroll bars for each frame. That takes up even more screen space, especially if you need them both to the left and to the bottom of the frame.

Coding

Let us have a look at the coding involved in producing a set of frames.

As I said at the beginning of this section, you first need to construct a page which is itself just a container. There is nothing in it besides the structure of the frames. The first thing to decide is how many frames you are going to need: the less the better. Then you need to decide whether to have borders and scroll bars. Finally you need to decide which pages will be loaded into the frames by default. (We will deal with the links, and page refreshes, later on in this section.)

You will start your coding of the page in the normal way:

<HTML>

<HEAD>

<TITLE>Runway to the Web</TITLE>

</HEAD>

The page has the usual HEAD section, which can contain the title and the various meta tags. Below that, however, we have a slight difference. Note that we do not immediately go into the BODY section. Instead we go into the FRAMESET.

The frameset gives the browser the information necessary to divide up the screen in such as way as to be able to accept more than one file. In the tag below is the information needed to set up two frames, one of which is set to a width of 129 pixels, which is approximately one and a half inches wide. The other frame takes up the remaining width of the screen, whatever that may be.

<FRAMESET cols="129,1*">

There are various ways of describing how much space the frames take up. One way is to define them absolutely, by giving each frame a definite size in pixels:

<FRAMESET cols-"200,400">

The above code will give a total page size of 600 pixels, which will be divided into two frames, one 200 pixels wide, and the other 400 pixels wide.

You can also set your frames to a percentage of the browser window. This is a dangerous things to do, because it will probably lead to some serious foul-ups in the way your designs are displayed on the myriad computers across the world which have variously sized screens.

The final option is to use the * (star). This is the asterisk key, but is called the star. When you use it the browser displaying your page will interpret it as indicating that you want to take up whatever is left over of the computer's screen to display the contents of that frame. Thus the original code for my page showed the left frame taking up 129 pixels, and the second frame taking up the rest of the browser window, whatever that space may be.

The next piece of code needs to be put in for ancient browsers that are still in use and which do not understand frames. For this we use the NOFRAMES tag. This is followed by the BODY tag, which contains a short piece of text which is displayed by the said ancient browsers:

<NOFRAMES><BODY>

<P>This page is designed to be viewed by a browser which supports Netscape's Frames extension. This text will be shown by browsers which do not support the Frames extension.</P>

</BODY>

</NOFRAMES>

That is all that goes in the body section. In fact that is all that would be displayed on screen in an old browser. In a new browser, nothing is displayed on screen from this page. All that is displayed are the files that are loaded into the frames. For that we need to produce the following code:

<FRAME SRC="../site-index.html" name="indexbar" NORESIZE>

<FRAME SRC="../Resources2.html" name="content" frameborder="no" padding=0 spacing=0 framespacing=0 border="no">

</FRAMESET>

In short we are telling the browser where the source of the content for the frame is to be found. In the first instance it is the "site-index" file. This is to be found (in this instance) in a higher directory, hence the unix directory listing "../"

You will notice that each frame has been given a name. The first one is called "indexbar", the second "content". The reason for this is that later we will want to direct pages into these frames and we need to know which frame to direct them into. If a frame doesn't have a name the browser is going to have a hard time putting a page into it. This name is called the TARGET.

Just like in tables, you can set values for the border of a frame, or for the padding, which will mean that the higher the value the further the contents will be set away from the edge of the frame; and for the spacing, where the higher the value the larger the gap between frames.

We have also set the first frame to NO RESIZE. This means we will have no scrolling facilities. If you want to have a scroll bar, you can add the code scroll=yes, or if you want the browser to decide, don't bother to add any code at all.

Finally, we close the HTML tag.

</HTML>

The above code will produce a page which will then go and look for the two files, and load them into the correct frame, so to view this page we have had to create three files.

In order to change the content of the right hand frame we need to use some linking code which is slightly different from the coding we have done before. Just putting in the usual A HREF code will not suffice. We need to specify more parameters: which target frame the page is to be loaded into, or whether the page is to be loaded into a different page altogether; and what relation that new page has to the first page.

Targets

There are four target tags: _self; _parent; _top; _blank. Note that all start with an underscore. You need to put this into the code.

By default a link will cause the new page to display in the current frame. Using the _self tag will merely confirm this.

To create a new browser window for the new linked page use _blank. There is a downside to this; the frames begin to stack up as you keep following new links. The old ones don't go away.

To get round this problem you need to use _top. This will cause the linked page to be loaded into the full browser window and all the old frames disappear.

_parent will cause your linked page to load into the previous frame. This would be useful if you had used some javascript to create a pop-up window. You might then want to go back to the window that took you to this pop-up window. Any link placed in this new window could be directed back to the previous frame by targeting to the parent frame.

What all this means is that if you set up a link from one frame, and want your new page to load into the second frame you must say so in your link code. If you have a page which contains two frames, one named Index, the other named Content, and you want to put links in the Index page which will load the new pages into the frame called Content you must specify that target frame.

An example of such code would be:

<A HREF="page1.html" TARGET="Content">

However, suppose you want to create a link from the page now in the Content frame. What would you do?

This is where we would start to use the code preceded by the underscore. If you had a link within page1.html, and you wanted that new page to load into the Content frame (the same frame) you would use the following code:

<A HREF="newpage.html" TARGET=_self>

Your existing page in that frame would now be replaced by the new page. If, however, you wanted that new page to load into a new browser window, you would have to change the coding slightly:

<A HREF="newpage.html" TARGET=_blank>

Nested Framesets

If you want to produce a more complex page, you can nest framesets within other framesets. The following code will give you two vertical frames, with the right hand frame subdivided into two horizontal frames:

<FRAMESET cols="25%,75%">

<NOFRAMES><BODY>

<P>This page is designed to be viewed by a browser which supports Netscape's Frames extension. This text will be shown by browsers which do not support the Frames extension.</P>

</BODY>

</NOFRAMES>

<FRAME SRC="">

<FRAMESET rows="16%,84%">

<FRAME SRC="">

<FRAME SRC="">

</FRAMESET>

</FRAMESET>

Putting the frames round the other way (one across the top, and two vertical frames below) would produce the following code:

<FRAMESET cols="75%">

<NOFRAMES><BODY>

<P>This page is designed to be viewed by a browser which supports Netscape's Frames extension. This text will be shown by browsers which do not support the Frames extension.</P>

</BODY>

</NOFRAMES>

<FRAMESET rows="13%,87%">

<FRAME SRC="">

<FRAMESET cols="29%,71%">

<FRAME SRC="">

<FRAME SRC="">

</FRAMESET>

</FRAMESET>

</FRAMESET>

Identity

Besides the problems with frames delineated above there are others. One of which is a problem which strikes at the very root of what the web is all about, and that is the linking mechanism.

If you link to another site, generally speaking that is fine. However, if you do it in a straight forward manner, the viewer moves off your site, onto the new site. If you use frames, then you can keep the viewer within your own site, which is a bonus. However, there is a downside to this.

Supposing the site you are linking to depends upon advertising, and your link byepasses that advertising. The site you are linking to is not going to be pleased, neither are its sponsors.

Supposing the site you are linking to wants to be credited with its content. You don't seem to be doing that. It is almost as if you are passing off the content as your own.

There has been a case in Scotland where the Shetland News offered a menu on its site that linked some headline stories directly to editorial copy which appeared in the rival web site run by the Shetland Times. Naturally the Shetland Times got upset and sued.

There has not been a judgment in this case, which is perhaps a pity. What has happened is that the two sides have come to an agreement. By this agreement the Shetland News can link to stories on the Times site, provided each link sports a logo and legend declaring it to be "A Shetland Times Story".

The integrity of the net has been maintained, and a blow has been struck to try and maintain some grip upon identity on the web. On the face of it, honour has been preserved all round. How long this will remain the case is another matter.

Further Info

Basic Frame tags
Search engines and Frames
Creating a Frame Layout
Targets and names
Using the _parent tag

Education Home Page

Runway Index

Back to the Top

© John Clare. runway