View Full Version : loading frames *all the time*

03-31-2003, 07:29 PM
I have a site in frames. So the the default page is index.html and it loads menu.html and main.html. Let's say someone goes to my site by going to www.mysitehere.com/main.html instead, is there a way using javascript to load each internal page (i.e. main.html) to be in a frame? So that when someone goes to www.mysitehere.com/main.html it automatically loads with menu.html also. Do I need a php script instead? Thanks.

03-31-2003, 07:48 PM
Have your page check to see if it is within frames, and jump to index.html if not:

if (self == top) {top.location='index.html';}

03-31-2003, 07:50 PM

03-31-2003, 07:52 PM
oic thanks.
sorry, i should've been more specific.

i actually want the effect to be the same for all other internal pages. for example, there's a link in main that goes to main2.html. so when someone goes to www.mysitehere.com/main2.html it'll also load the menu.html. so just redirecting to index.html would not work cuz that would just load the menu and main.html and not main2.html.


03-31-2003, 07:59 PM
If the page is not within frames, link to index2.html?pageID. The index2.html link goes to either a CGI routine or a JavaScript-enabled page (your choice; either would work) which pulls the query string and puts the menu and target pages within the frameset constructed on-the-fly.

You can see this concept in action at my site. Go to the link below, wait for the frames to show up, click on the header of the lower-right frame, move around a bit, then click on the "Return to frames" link at the bottom of whatever page is then current. The site address is:


04-02-2003, 03:14 AM
everything works. thanks.