[Javascript] Frame re-load Question

Peter Brunone peter at brunone.com
Tue Dec 18 13:01:36 CST 2001


Tim,

    This will be a two-part solution.  First, you need to include some
Javascript in the indexed page, along the lines of

if(top.location.href == window.location.href) {
    top.location.href = "frameset.html?currentpage=thispage.html";
    }

    Next, you need to set up your frameset to receive the querystring
variable "currentpage" that contains the proper page to host in the
frameset.  This is much simpler if you have access to a server-side
development environment such as ASP or CGI; you can simply write the correct
page name into the SRC attribute of the correct frame.  If however you have
only client-side Javascript, you will need to parse window.location.href to
find the part after "currentpage=", and then change the location of the
proper frame, e.g.

var myCriteria = window.location.href;
myCriteria = myCriteria.substring(myCriteria.indexOf("currentpage=") +
"currentpage=".length, myCriteria.length);

    I've had trouble getting a script in the frameset page to change the
location of an existing frame, but you can always use Javascript to
document.write the entire frameset to the page...

Cheers,

Peter

----- Original Message -----
From: "Tim Makins" <timothy at utvinternet.com>
To: <javascript at LaTech.edu>
Sent: Tuesday, December 18, 2001 10:55 AM
Subject: [Javascript] Frame re-load Question


| Is there any way that if someone finds a page through a search engine that
| should belong in a frame-set, the page would automatically reload itself
| into the frame set ?
|
| The key point here is that when the frameset is brought up, it should
| display the 'found' page in correct position, rather than the frameset's
| normal starting page.
|
| Tim in Ireland, hoping this is clearer than mud.
|
|
| _______________________________________________
| Javascript mailing list
| Javascript at LaTech.edu
| https://lists.LaTech.edu/mailman/listinfo/javascript
|






More information about the Javascript mailing list