Sample Frame Content Page


This is the content page - the one that is most likely to get "found" by a search engine user. Of course, the search engine won't know anything about your cleverly-designed <frameset> page. There is a piece of JavaScript magic in the <head> section of this page that fixes the problem. The JavaScript checks to see if the <frameset> page is the top window and if not, it automatically loads the <frameset> page which has some magic JavaScript of its own that can detect the referring page and load it in its proper position. Click here to download the pages in a ZIP file.

To see it for yourself, click here. The link points directly to the URL for this page. The page will load into the browser and before any content is displayed, it will re-direct the user to the proper <frameset> page.

The script in the <frameset> page examines the URL to check for the presence of a code in the query string (ie. the information that comes after the question mark in the URL). Then it splits that message into two parts, the framed page's URL and its frame number, and loads everything into its proper frame without making the user jump through any links.

In this example, there are three frames. The top frame (numbered #2) which displays the top banner bar and the page name. The left frame (numbered #0) contains the navigation menu. And, finally, the frame for this page (numbered #1) which contains the main content pages in this simple common layout.

Installing this system on your site requires copying the JavaScript you'll find on these pages into your pages and modifying it to match your site's file names. In the JavaScript in the head of the <frameset> page (ie. the page named 'reframe.html' on my site here), you need to change the settings of the variables 'wFrame0', 'wFrame1', and 'wFrame2'. 'wFrame0' is the URL of the <frameset> page, 'wFrame1' is the URL of the page that you want loaded into the <frame> with the name attribute set to 'menu', and 'wFrame2' set to the URL of the page you want loaded into the <frame> with the name attribute set to 'content'.

On all of the other pages, you'll need to copy the JavaScript from the head section of one of the framed pages here (for example, this page named 'reframe_main.html') into the pages of your site that are designed to be contained within your <frameset> page. In the JavaScript for the framed pages, set the variable 'framePage' to the URL of the <frameset> page, and set the variable 'thisPage' to the URL of the current page, and set the variable 'frameNo' to the number of the frame into which the page should be loaded. In the example here, frame number 0 is the menu frame, and frame #1 is the main content page.

Purists will note that this scheme relies on the user having JavaScript enabled in their browser. Its just one of those things you have to accept when you have framed pages. Fortunately, the number of users who run with JavaScript disabled is low. There was a period not long ago when many users turned off JavaScript to avoid pop-up windows, but the proliferation of free and low-cost pop-up blocking software has diminished that trend.

Please Note: I urge you to avoid using frames at all costs. The disadvantages to your website and to your users far outweigh any possible benefits. The search engines can read frames, and this system will help you mitigate the problems involved, but you'll still be putting out fires for as long as your site relies on frames. There are many simple alternatives that will give you the same capabilities without the problems. See my No Frames Navigation System for some ideas to help you move away from frames.




home page iconReturn to the Main Rainbo Design's Website Tools and Scripts Page