MORE ABOUT FRAMES
|
There are a few more things you need to know about to get frames working really well.
One is that even in this day and age there are still people out there who are using browsers
that don't support frames. Since browsers will almost always ignore any HTML tags they come
across that they don't recognize, non-frames capable browsers simply won't see the FRAMESET
and FRAME tags. This means that all that time you spent setting up the site would be wasted..
except for the NOFRAMES tag.
|
The NOFRAMES tag
Browsers that can handle frames will ignore the NOFRAMES tag and its contents,
while browsers that can't handle frames won't see the tag itself, but will display its
contents. So after the closing FRAMESET tag, put a NOFRAMES tag, with some text and perhaps
a link to the main page of the site. NOFRAMES is a container tag, requiring the matching
closing tag, takes no attributes and can contain other active HTML elements.
|
|
|
The other major consideration when using frames is targeting your links. In non-framed
pages any <A HREF> will cause the new page to load in the same browser window that the
link itself is in. When using frames, you must specify where you want the new page to
show up. The TARGET attribute for the A link accomplishes this.
|
|
The TARGET attribute and its values
The TARGET attribute of the A tag can take any text string as its value. If you have been
thinking ahead and used the NAME attribute in declaring your FRAMEs, then you can use the
values of those NAMEs as values for the TARGET. In our example site, we named the left
column "TOC", for Table of Contents, and the right column "MAIN". So any link in "tableofcontents.html"
that we want to show up in the MAIN window should have a TARGET="MAIN". The values for
TARGET are case-sensitive, "MAIN" is not the same as "Main" or "main".
There are a few things that you shouldn't NAME FRAMEs, because they have special
uses in TARGET.
|
|
|
|
_blank
This loads the new page in a new blank browser
window. Use with caution, as this steps outside the
history list and the viewer's BACK button will no longer work.
|
|
|
_self
This loads the new page into the same window or frame that the
link itself is in.
|
|
|
_parent
This loads the new page into the current windows parent, usually the frame
window immediately preceding in the FRAMESET declaration. If no parent exists,
it acts like _self.
|
|
|
_top
Loads the new page into the topmost frame in the FRAMESET. Not physically top,
but first in the specification.
These sound a little daunting, I know, but the only ones I've ever actually used are
_self and _blank.
|
| |
|
If declaring the TARGET for every A HREF on each page sounds like a lot of work, don't
worry, there's a short cut. You can use the <BASE> tag.
|
The BASE tag
The BASE tag goes into the HEAD section of your page. It is not a container tag,
and is used to set specific attributes of the whole page, including:
|
| |
|
|
TARGET
This sets a default target for all links within the page. It can take any text string
as its value, but if you use a value that does not correspond to a named window or one of
the "special" names, the browser will either give an error message or create a new window.
Can be overriden by local use of the TARGET attribute in the <A> tag.
|
|
|
FONT
If you want the standard font size on your page to be something other than the default
of 4, you can set it with this attribute. Value can be any number from 1 to 7, with 1 being
the smallest size and 7 the largest. Can be overridden by local use of the <FONT> tag
and SIZE attribute.
|
| |
|
Something to know about frames is that only the TITLE of the FRAMESET page will show up
in the browser's titlebar and bookmarks, so make double sure it's appropriate.
One last note about frames. As I mentioned earlier, there are plenty of people who don't
like frames. Some of the reasons are valid, and some are just plain petty. But weather or not
their reasons are valid, their opinions are set. So before you use frames, ask yourself
Design Question #2 again - "Who am I trying to attract?" - and then decide.
|