W3C home > Mailing lists > Public > www-html@w3.org > August 2000

RE: linking in frames

From: Eric Costello <eric@schwa.com>
Date: Thu, 17 Aug 2000 09:40:25 -0500
To: "Catherine Sherman" <catherine_sherman@hotmail.com>, <www-html@w3.org>
>From an OUTSIDE DOCUMENT, I would like to create a hyperlink
>that loads my frames page, and loads a specific page into
>the main content frame.

There is no built in mechanism in HTML for that. It can be done, but it
takes work. The easiest and best way is to use some server side processing,
passing a parameter to your frame page (like
"frame.asp?content=desiredPage.html") which builds the frameset with the
value of "content" for the src of the main content frame. This can be done
in any server side processing environment, like ASP, CGI, PHP, CFM, etc.

If you can't use server side code, this can also be accomplished with
Javascript running client-side. Same idea, you pass a parameter in the URL,
but in this scenario you would use Javascript to document.write the frameset
with the value of "content" for the src of the main content frame. Requires
the user have Javascript on, but can be written to degrade without errors,
but also without the desired content on the main content frame.

I have also seen it done where you link directly to the html page you want
loaded in the main content frame. In that HTML page you add a little
Javascript that can tell if it is loaded in the proper frameset, and if not,
reloads the document with the "frame.asp?content=content.html" URL. You then
of course have to use one of the techniques above to get the frameset drawn
with the correct src for the main content frame


Eric Costello

Eric Costello
Received on Thursday, 17 August 2000 10:42:13 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 15:05:54 UTC