[thelist] ANOTHER frames question

Sam-I-Am sam at sam-i-am.com
Wed Sep 12 13:17:14 CDT 2001

[mail server died, so this is a bit stale by now]

another frames answer :)
The problem with just re-drecting the user to the frameset, is that they
lose their place, and have to drill down to that page again.. A tedious
and sometimes impossible task. 

What you need is to be able to link to a page that you can tell it, put
this page inside my frameset.  You can do this serverside or client
On the serverside, you would have a simple script that accepts a single
argument - the url for the main frame, and prints out your frameset with
that url inserted as the relavant frame's src. 
Then on all your pages that are supposed to be framed, you can put a
link to this script something like this: 
 <a href="/cgi-bin/frames.cgi?url=/thisdir/thispage.html">place in

Or, you can do it client-side with javascript. If your frameset is
frames.html, you have have the same kind of link:
in frames.html, javascript examines the location.href (or the
location.search property) and dynamically document.write() the frameset
out, again inserting the appropriate url into the appropriate frame src. 
(Or, you can also have the frameset be static, and load in a
dummy/placeholder page initially, and then switch the location to the
given url. This is a little easier to maintain, though not as
transparent to the user. )

The client-side way tends to be easier to set up and more convenient --
for you -- but obviously risks excluding some users with no javascript
or javascript turned off. 

You can of course leave all your links as they are and just add a check
to each page that says am I in a frameset, if not redirect to
/frames.html?etc.. I find this a little obnoxious, and would rather just
see a link that gives me the option. 


"Green, Janet" wrote:
> The earlier question about frames has reminded me that I've always wanted to
> ask this question: is there a way to create direct links to pages that load
> within a frameset, but that still actually loads the frames around them?

More information about the thelist mailing list