:: code war·ri·or                    
                   

Frame PAGES

Now that you've mastered frame sets, all you need to do is create the frames pages themselves.

These pages are just normal HTML pages - so normal that they could be opened independently of the frame set and would display perfectly well, although they might seem out of context depending on your site design.

Having said that, there are just a few more things you need to know.

Link Targeting

Normally creating links is easy. If you have not read the links section yet click here.

In frames, the same principles apply. The addressing system works in exactly the same way, but remember that paths should use the frame document as their base or origin and NOT the frame set (this will only make a difference if they're in different directories).

What you must also consider is where (in which of your frames) you want the new page to be displayed. This is where the frame names and the TARGET attribute of the A tag become very important.

Example FramesetLet's imagine you've got a frame set like the one on the right, where the top frame is called BANNER and the bottom one MAIN. Say you've got a link in the banner frame and you want the document it points to to be opened in the main frame. The A tag would therefore look like this:

<a href="file.html" TARGET="main">Click Here!</A>

The target attribute is set to the name of the frame that you want the link to open in. This is why it's important that each frame has a different name.

To see this in action, click here.

Other Targets

You can also use some special target names in the A tag to do some specific tasks:

_top The file specified will fill the entire browser window, removing all frames.

_self The file will open in the current frame, i.e. where the link is.

_parent The file will fill the current frame set. Unless you're using nested frame sets (frame sets which open other frame sets in one of their frames), this will have the same affect as _TOP.

_blank Opens the file in a completely new browser window with no frames.

If the target you specify does not exist, a new browser window will be opened and given that name. Any other links that use the same target name will now also open in that window.

Whenever you link to an external site, always use _top or _blank to prevent the site opening within your frame set.

NOFRAMES Considerations

Moving away from links and targets, we come to a very important point about frames. Not all browsers can read them!

Some (mainly older) browsers are unable to understand frames and so anyone using them will not be able to view your pages. To be fair, most modern versions of browsers will read frames but with all the new gadgets like mobile phones, out there using the web you can never be too sure. Also, and more importantly, search engines cannot understand frames. This means that your site will not be able to be listed on search engines unless you give them some real content to read.

To get around this problem, we have the NOFRAMES tag. This goes in your frame set file, after all the FRAME tags (but before the final </FRAMESET> tag). It can contain absolutely any HTML which will be displayed to anyone who can't see the frames.

At the very least you should use the NOFRAMES tag to put a brief message telling the user what has happened and how to upgrade their browser:

<NOFRAMES>

<P>This site uses frames, but your browser doesn't support them.</P>

<P>To upgrade your browser, visit the <a href="http://www.microsoft.com/ie/">Microsoft</A> or <a href="http://www.netscape.com">Netscape</A> web sites.</P>

</NOFRAMES>

A much more useful approach would be to provide links to some of your frames pages so that the user can still get to some of your content. You could even design a completely separate non-frames site and link to it from the NOFRAMES section.

Unless you take one of these latter options, it is very unlikely that any search engines will register your site. They will look in the NOFRAMES section and try to follow any links there, but they will not view the frame set.

Rogue Frames

Sometimes people may accidentally find themselves viewing a page on its own that should be part of a frame set. This is normally due to a link either within your site or from an external site. Depending on your frame layout, this can make it very difficult for that person to find their way around.

For this reason, it may be worth including on all your frames pages a link back to your frame set. Make it fairly obvious what it is. Also set the target to _TOP in case your frame has loaded in someone else's frame set.


· code-warrior
· HTML Tutorials
· Frames


Quick Links
· What are Frames?
· Frameset Attributes
· Frame Pages
· Frame Templates


SHOP
· Book @ Amazon
· Software @ Amazon

Please send any comments to
This HTML guide is a free resource
© Code Warrior 2002