homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

Force Frames
Rebuilding frames around orphaned pages

 6:07 pm on Jul 30, 2003 (gmt 0)

My Web site is designed using frames, and I have a problem. When a search engine or link from an external site links to one of the pages within my site (i.e., not the home page), the frame gets lost. In many instances people want to link to an internal page in my site and not the home page. I have found some javascript that always displays the home page within the frameset no matter what other page forms the link but I want to display the referenced page whatever it is within its frameset.

Example: www.mysite.com/index.html displays my site?s home page with a top frame (banner), left frame (navigation), mainframe (content). If the search engine link is to www.mysite.com/otherpage.html it displays the page outside of the frames. I want otherpage.html to appear wrapped in its proper frameset.

How can I get these pages to build a frame around themselves? Does this make sense? Sorry to be so wordy ;-)





 6:28 pm on Jul 30, 2003 (gmt 0)

You probably won't like this suggestion;), but one work-around is to abandon frames and use tables to create a "framed look" on each of your pages.


 7:13 pm on Jul 30, 2003 (gmt 0)

Hi Cloudthumper,

Welcome to Webmaster World [webmasterworld.com].

yep, orphaned pages are a problem when using frames. I used to use a two-part solution. One was a 'dynamic frameset' where javascript built the frameset on the fly. This had the advantage of being able to use one frameset for each section of my site and be able to load any page I wanted to into it using a variable in the url, something like domain.com/main-frame.htm?content=blue-widget.htm. You can make these scripts almost as flexible as you'd like with as many frames dynamic (head, toc, content, etc), but I hard-coded the head and toc frames to keep the urls fairly short and manageable. Dyamic frameset script come in a lot of flavors, I used the one from Netscape. A quick Google search will pull up quite a handful, you should be able to find one to fit your needs.

Next you need a simple 'frame buster script' (again, Google it). It simply says that if this page is not in a frame or not in the frame it's supposed to be, then put it in the correct frame. You'll have to write a couple of extra lines of js to get this to work with the dynamic frameset but if I was able to do it, any one can. Get to know the ins and outs of the dynamic frameset first, then incorporate the frame buster script on each of your pages.

Hope this helps,



 7:54 pm on Jul 30, 2003 (gmt 0)

We've also got some example code that may help you on our Generic Javascript [webmasterworld.com] thread.

Look under message #21 ---
Force Many Pages Into Frames
with one simple script"


 8:09 pm on Jul 30, 2003 (gmt 0)

Nice tedster. The Netscape and other versions start really beefed up. Anybody can start with your version and build on it as needed. Very elegant.


 10:56 pm on Jul 30, 2003 (gmt 0)

Thanks for your help, tedster.

Forgive me for being such a novice.

Your script works very well except for one thing. I have three frames: top for the banner, left for the navigation, and the content frame.

I can get your script to display only the left frame and the content frame:

How do I modifiy your script to make it display all three frames?

Thanks again.


Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved