This is FrameStuffer Version 3.2.2

What it does
Installation
Requirements
A short example
Compatibility with FrameJammer How it works

Usage notes
Site navigation
Using with templates
Using with anchors
Passing values
(You may want to print this file - there's a lot here.)

WHAT IT DOES

FrameStuffed pages opened "naked" in a browser window or in the wrong frame will find their parent frameset and position themselves in the correct frame (tested with Netscape and Internet Explorer versions 3+ in Windows, NS 3+ and IE 4+ on the Mac).

The FrameJammer extension still works great and does the same, except that with FrameJammer the default page for the frameset shows briefly as it starts loading before the page being jammed is pulled in.

This isn't really an issue if it only happens once when a visitor arrives from a search engine, but if you want to use the technique for in-site navigation (see below), the page flashes can be come noticeable. FrameStuffer eliminates this problem.

Top

INSTALLATION

DREAMWEAVER 4 and higher: Use the Extension Manager.

DREAMWEAVER 3 and lower: Drop 'FrameStuffer.htm' and 'FrameStuffer.js' into your CONFIGURATION>COMMANDS directory. Drop 'fStufferHelp.html' and 'fStuffer.gif' into a HELP directory in the CONFIGURATION directory (if it doesn't exist, you should create one as you'll need it to use the Help button).

Reload extensions if Dreamweaver is open.

Top

REQUIREMENTS:

The first time you use 'FrameStuffer' with a frameset, you must SPECIFY THE DEFAULT PAGE and THE DEFAULT FRAME in which that page should appear when the frameset is opened normally. FrameStuffer does this for you when you follow this procedure:

  1. First, create a frameset with a blank page in the frame that will hold your default page (this is the page to use when the frameset is opened directly in a browser).
  2. Name the frames, save everything then close the frameset.
  3. Open the default page for the frameset and apply 'FrameStuffer', selecting the frameset you just created, and the name of the frame with the blank page in it.

Now you may continue to apply 'FrameStuffer' to any other pages that you want to find this frameset and position themselves in any of the frames (default frame or otherwise).

NOTE: The first page you apply FrameStuffer to after creating the frameset will be the default page! If you later want to change this, open the frameset page in code view. You'll see a line like this:

var theDefault = 'somepage.htm';

Change somepage.htm to whatever page you want, remembering to include the path from the frameset page. Alternatively, you can delete all the FrameStuffer code in the frameset page and start over.

Top

A SHORT EXAMPLE

The image on the right is a typical frameset ('index.html'). Assuming that frame 'fright' is where you want your default page 'main.html' to appear, you set it up with a blank page in 'fright', and name all the frames. Your frameset code looks something like this:

<FRAMESET rows="62,*">
  <FRAME name="ftop" src="topFrame.html">
  <FRAMESET cols="160,*">
     <FRAME name="findex" src="leftFrame.html">
     <FRAME name="fright" src="blank.html">
  </FRAMESET>
</FRAMESET>

Don't forget to create all the pages including 'blank.html' before creating the frameset. While 'blank.html' has no content, you may want to set the background to match your site. Save the frameset then close it.

Now open 'main.html', the default page for the frameset, in Dreamweaver and select 'FrameStuffer' from the command menu. Initially, you see:

Frameset

Frame

When a FrameStuffed page is opened directly in a browser (as from
a search engine results list), the page will find the frameset you select
above, then position itself in the frame you specify.

Anchors may also be specified. Check the Help file for details.


Browse to and select the frameset with the blank page ('index.html'). The display changes to:

Frameset

Frame

WARNING!

If this is not the default page for the frameset above, Cancel now
then open the default page and apply FrameStuffer to it before
applying it to this or any other pages that belong in this frameset.

The Frame menu now lists all the frames in the chosen frameset, so select 'fright' then punch the "OK" button (not shown). This writes the handler code into the frameset ('index.html') and normal FrameStuffer code into 'main.html'.

Now you can apply FrameStuffer to the other default pages, specifying the other frames (e.g., 'findex' for the 'leftFrame.html' page), as well as other pages that should appear in this frameset.

HEED THE WARNING IN THE DIALOG BOX:  FrameStuffer must first be applied to the page you want as the frameset default so it can write the correct code into the frameset. This warning only appears if the selected frameset does not have FrameStuffer code in it.

Top

FRAMESTUFFER COMPATIBILITY WITH FRAMEJAMMER

If you want your current frameset to work this new way (no temporary default page flash), you'll need to modify the frameset, but all your FrameJammed pages remain the same if you:

1. Open the frameset (that's the frameset, not any of the individual pages that have been FrameJammed) and delete all the old frameJammer code, including the 'onLoad' call in the <FRAMESET> tag.

2. Redefine your frameset to put a blank page in the default frame (you need to create a blank page).

3. Open the page you want to show up as the default page in the frameset and apply FrameStuffer to it, selecting your modified frameset as the target.

This writes new code into the frameset, and all your old pages and any new ones you stuff or jam will continue to work as expected.


Top

HOW IT WORKS

FrameJammer includes "frame busting" as an anti-hijacking measure, to reduce the chance of having your pages used in frames on other sites. The frameset page checks to see if it's at the top level of the browser window and if not, breaks out. This is code, and it may be removed if you like:

if (self != top) // frame buster, may be removed
   top.location.replace(self.location);

Individual framed pages, because they belong in frames, can't use the same technique. Instead, they check the name of the frame they're in. If it's wrong, they "bust out" and positions themselves in the correct frame in your frameset. This won't work if the foreign frame has the same name as yours, so you might want to avoid likely frame names such as "main" and "content". Instead, you might use names like "mainhp" or "hpcontent", using your own initials.

Regardless of frame names, pages opened "naked" find their frameset and position themselves where they belong (if you followed the 'USAGE NOTES').

Top

USAGE NOTES:

  1. FrameStuffer works with pages that are in the same directory as the frameset page, or in directories below the one containing the frameset page.
     
  2. Remove any "frame buster" code you may have in the page as FrameStuffer will handle it for you.
     
  3. When working in a new frameset, name the frames then save all the pages and the frameset before applying FrameStuffer.
     
  4. After selecting a target frameset, you are given a pick list of the frames in the set. If the page you're working on is one of the default pages for the frameset, the list consists of only the correct frame.
     
  5. If FrameStuffer is already in a page, you are shown the names of the targeted frame and frameset (and an anchor if there is one). To change the targets, use the 'Change' button. You may also 'Remove' FrameStuffer from the page.
     
  6. Double stuffing doesn't work. I was able to confuse a browser by specifying that one of the default pages in frameset A' actually belonged in 'Frameset B', then trying to stuff a different page into 'Frameset A'. You're not likely to design a site this way, but if you do get strange behavior (or non-behavior) check for conflicts in the frameset default pages.
     
  7. If you do want to use the same page as a default page in multiple framesets, use the same frame name in all the framesets. You'll only be able to stuff the page into one of the framesets, but it won't kick itself out of the others.
     
  8. Using JavaScript reserved words as frame names confuses JavaScript and can cause Infinite Reload Cycles and/or crashes. 'top', for example, is a no-no as a frame name, although it may work some of the time.
     
  9. Don't use tildes (~) or underscores (_) in your frame names.
     
  10. Do not use 'booker_' for any of your frame names. That's partly because of the underscore, but also because I've rewritten the frame name test to look for the frameBooker window so you can use both extensions in the same page (a fairly likely scenario). There was no change to the handler function in the parent frameset, so it will continue to work fine on a site with mixed pages (created with this and earlier versions of frameJammer and FrameStuffer).
     
  11. 'Remove' will remove FrameStuffer from a page, but will not touch the code handler written into the parent frameset because other pages may need it. This may be removed manually to save a few bytes.
     
  12. A user found that pages would not print from Netscape 4.x and that is now fixed. Earlier versions wrote a frame name test into the page like this:

    if (window.name!='<frame>')
    or
    if (window.name!='<frame>' && window.name!='booker_')

    That is now changed to:

    if (window.name!='<frame>' && window.name!='booker_'
    && !((self.innerHeight == 0) && (self.innerWidth == 0)))

    The problem was that Netscape opened a new invisible window to print the framed page, and frameJammer kicked in because it knew it was in the wrong place. If you've jammed a lot of pages, I found that the Search-and-Replace in Dreamweaver worked fine to make the changes for me. I've included the code here in case you want to do a search-and-replace update of your pages.
Top

USING FRAMESTUFFER FOR SITE NAVIGATION

Building an index page for a framed site can be a problem. Assume a site structure like this:

frameSet.html
siteIndex.html
pages ----------\------ pageA.html
                 \----- pageB.html

The frameset and site index pages are in the same directory, with framed pages in a sub-directory called 'pages'. After applying FrameJammer or FrameStuffer, you could make a direct link to the pages in 'siteIndex.html', like

href="pages/pageB.html"

This works, but pageB.html will first start to load before going on to find frameSet.html and positioning itself in the correct frame. This is okay if it only happens once, as from a search engine link, but becomes annoying if it keeps happening. To stop that, you use FrameStuffer rather than FrameJammer

  1. First, set up frameSet.html with a blank page in your main content window.
     
  2. Open the page you want as the default page for the frameset, and apply FrameStuffer to it, selecting this frameset and the frame with with the blank page as the targets.

For navigation links, you then link to the frameset page and specify which page you want loaded ('fright' is the name of the frame for the page) like this:

href='frameSet.html?pages/pageB.html~fright'

That looks a bit complicated, but you can have FrameStuffer show you how to do it. Before setting up your index page, apply FrameJammer or FrameStuffer to the pages you'll want to link to. Then look at the code that was written into each page. You'll find a line that looks something like this:

top.location.replace('../frameSet.html?pages/pageB.html~fright');

Use the part in parentheses:

'../frameSet.html?pages/pageB.html~fright'

The '../' indicates that the frameset page is in the directory above the one the page is in. That's correct for 'pageB.html', but is not correct for 'siteIndex.html' because the site index page is in the same directory as the frameset. To compensate for that, you would modify what was written and your link in 'siteIndex.html' in this example would become:

href='frameSet.html?pages/pageB.html~fright'

The rule is: use the path to the frameset from your page on the left of the '?' and the path to the page from the frameset on the right of the '?'. If this is still confusing, a bit of trial and error should clear things up.

Top

USING FRAMESTUFFER IN DREAMWEAVER TEMPLATES:

There's no simple way to use FrameStuffer in Dreamweaver templates. FrameStuffer writes a line like this on each page to be stuffed:

top.location.replace('../framesetpage.html?path/page.htm~frame');

The page being stuffed and the path to it from the frameset directory ('path/page.htm') are "hard coded" so this won't work in a template. For a while, I had FrameStuffer write code that does work in a template:

top.location.replace('../framesetpage.html?'+location.href+'~frame');

The problem with that is that it does not work in Netscape 4.08, and I received notes about it from a number of people, so I changed it back. If you don't care about NS 4.08 surfers, you can apply FrameStuffer, then change the line as above before saving the page as a template.

NOTE: USE THIS AT YOUR OWN RISK.

If you do use the code above in a template, you also need to make a change to the FrameJammer code in your frameset page. Open the frameset page and find this line:

if (framedPage.length>1 && framedPage.indexOf("://")==-1){

Change it to read:

if (framedPage.length>1){

Now save the frameset page and close it.

NOTE: This creates a potential security hole that might allow someone to insert one of their pages into your frameset. The inserted page would then have access to information in the frameset such as cookies and variables, or could be a form that asks the visitor for data then submits it to the dastardly person inserting the page. While the visitor would have to arrive from a special link on the dastard's site, it could happen. USE AT YOUR OWN RISK.

Top

USING ANCHORS WITH FRAMESTUFFER

You can now specify an anchor in the page you're stuffing, but you need to do it manually. First apply FrameStuffer to a page. In the code FrameStuffer wrote, find the line that looks something like:

top.location.replace('index.html?thepage.html~fright');

and insert the name of your anchor like this:

top.location.replace('index.html?thepage.html@theanchor~fright');

Note that you must use the '@' rather than '#' because of a JavaScript issue. Now open the frameset, and add the section of code as shown below in red::

var theDefault = 'main.html';
var theFrame = 'mainFrame';
var thePage = theDefault;
var framedPage = location.search;
    if (framedPage.length > 1 && framedPage.indexOf("://") == -1){
      framedPage = framedPage.substring(1);
      var theSplit = framedPage.lastIndexOf('~');
      if (theSplit != -1){
          thePage = framedPage.substring(0,theSplit);
          theFrame = framedPage.substring(theSplit+1);
      }else
          thePage = framedPage;
      // insert anchor code here if required
      
if (thePage.indexOf('@') !=-1){
      
    re=/(\S+)@(\S+)/
      
    theArray = re.exec(thePage);
      
    thePage=theArray[1]+'#'+theArray[2];
      
    }
      }

function frameStuffer(){
    eval('top.frames["'+theFrame+'"].location.replace("'+ thePage +'");');
    if (theFrame != 'mainFrame'){
        top.frames["mainFrame"].location.replace(theDefault);
        theFrame = 'mainFrame';
        }
    }

If for some reason you need to use a different symbol than '@', change it here as well as in your page code.

Top

PASSING VALUES

A user needed to pass a query string to dynamic pages being stuffed, so came up with a modification to the code in the pages (thanks, Steph). To use it, you first apply FrameJammer/FrameStuffer to a page, then add this code:

<script>
var qstring = location.search;
if (qstring.length > 1)
   qstring = qstring.substring();
</script>

And modify the line that reads something like:

top.location.replace('../framesetpage.html?path/page.asp~frame');

to include the variable that is determined above:

top.location.replace('../framesetpage.html?path/page.asp'+qstring+'~frame');

You'll have to apply it by hand, but it will do the job.

Top

 

As usual, use at your own risk. If you run into problems please print the Help file out, then try again. If that doesn't work, let me know and I'll see what I can do to help.

Enjoy.

Hal
http://www.pawluk.com/public/