Welcome to WebmasterWorld Guest from

Forum Moderators: open

Message Too Old, No Replies

Javascript: putting a frames page back into its frameset

frames top location



6:14 pm on Aug 10, 2003 (gmt 0)

Inactive Member
Account Expired


I am trying to build a website using frames.
There are 3 frames called top,navbar and window

I can use links from the navbar frame to open new pages in the window frame ok.

The problem is that I want all the pages that appear in the window frame indexed by the search engine robots when they come a calling but when someone clicks on a link to come to a window page I want it loaded in its window frame with top and navbar frames in place.

I have tried

if (window == top) top.location.href ="index.htm";
but this has no effect. The frameset info is contained in index.htm

Any suggestions?

6:19 pm on Aug 10, 2003 (gmt 0)

Preferred Member

10+ Year Member

joined:Apr 4, 2003
votes: 0

you would be wanting this:

if (top == self) {self.location.href = "index.htm"}

I don't think it's a great idea to call one of your frames "top" though as it could cause problems.

6:29 pm on Aug 10, 2003 (gmt 0)

Senior Member

WebmasterWorld Senior Member tedster is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:May 26, 2000
votes: 0

Welcome to WebmasterWorld, elfeste.

I think we have just the thing you need. Check our Generic Javascript thread [webmasterworld.com] and go to Message #21, "FORCE MANY PAGES INTO FRAMES with one simple script"

This script was written for a 2-frame frameset, but it's simple to adapt to your situation - just change the document.write line to write out your frameset configuration. Nothing else needs to be changed.

The advantage this script has over sullen's solution
(which also works) is that your visitors from the search
engines can get your frameset with the particular page
they clicked on already loaded -- instead of the "default"
configuration of index.html.