Paul McFedries' Web Home


The cover of The Complete Idiot's Guide to Create a Web Page The CIGHTML Mailing List
Frequently Asked Questions - Frames

Main FAQ page

I have a frame with lots of links. Is there an easier way to specify the TARGET than adding it to every single <A> tag?

Yes! You can define a default target by including the <BASE TARGET> tag in the page header:

<BASE TARGET="YourFrameName">

Here, YourFrameName is the name of the frame that you want to use for all your links. It can also be one of the pre-fab frame names, such as "_top" or "_blank". Once you put this in place, you don't need to use TARGET in your links (unless, of course, you want to use a different target for a particular link).

How do search engines index framed pages?

Here are some pointers about frames and search engines:

  • Most search engines will index only the frameset page (the one with the <FRAMESET> and <FRAME> tags). Therefore, be sure to include <META> tags in this page.
  • Some search engines don't index <META> tags, so you might consider putting some kind of indexable content between <NOFRAMES> and </NOFRAMES>.
  • If you want the search engine to index your "inside" pages, then it's also a good idea to include a link to those pages between <NOFRAMES> and </NOFRAMES>. This gives the search engine an entry point into the rest of your site.
  • The problem with the latter suggestion is that surfers could easily end up in an inside page that lacks your framed navigation controls. However, you can use JavaScript to "reframe" the page. I have a script that does just that.

How do I change more than one frame from a single link?

The only way to do this is to have your link point to another frameset page. For example, suppose your original frameset page looks like this:

<FRAMESET COLS="100,*">
<FRAME SRC="menu.html" NAME="Left">

    <FRAMESET ROWS="50%,*">
    <FRAME SRC="one.html" NAME="TopRight">
    <FRAME SRC="two.html" NAME="BottomRight">
    </FRAMESET>

</FRAMESET>
This page sets up a frame on the left (named, boringly, "Left") and two frames on the right ("TopRight" and "BottomRight"). To change the two right frames in one fell swoop, set up your link to point to an identical frameset page that uses different SRC values in the "TopRight" and "BottomRight" frames:
<FRAMESET COLS="100,*">
<FRAME SRC="menu.html" NAME="Left">

    <FRAMESET ROWS="50%,*">
    <FRAME SRC="three.html" NAME="TopRight">
    <FRAME SRC="four.html" NAME="BottomRight">
    </FRAMESET>

</FRAMESET>

I don't want my site displayed in someone else's frames. Is it possible to prevent that?

Yes. Assuming your frames page is named "myframes.html", insert the following JavaScript into your page between the </HEAD> and <BODY> tags:

<SCRIPT LANGUAGE="JavaScript">
<!--
if (top != self)
    top.location.href="myframes.html"
//-->
</SCRIPT>

How do I set up my a frames without borders?

You need to add both FRAMEBORDER="0" and BORDER="0" to your <FRAMESET> tag, like so:

<FRAMESET COLS="25%,*" FRAMEBORDER="0" BORDER="0">

Main FAQ page


Copyright © 1995 - 2014 Paul McFedries and Logophilia Limited