SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    May 2002
    0 Post(s)
    0 Thread(s)

    Question Javascript frameset redirect

    Hi, I wonder if anybody could possibly point me in the direction of a js applet that handles redirection for a framed site (I know).

    Essentially, if somebody enters my site via a link to a single page, I'd like the page to load within the correct frameset. I've seen some simple scripts that will redirect to the frameset but none that will put selected page within the target frame.

    Hope that makes sense. Many thanks, Steve.

  2. #2
    Perl/Mason Guru Flawless_koder's Avatar
    Join Date
    Feb 2002
    Gatwick, UK
    0 Post(s)
    0 Thread(s)
    1) Java Aplets OR JavaScript Scripts - NOT both

    2) You want a script that redirects any user to the frameset AND puts the right page in the right frame.

    Well if this is so - you should really adopt a server side language to accomplish this and use the Js of:

    // In the frameset page:
    // Make sure the frameset doesn't load inside a frame:
    if (top.location != self.location)top.location = self.location;

    // In the children pages:
    // Make sure I am not the parent - i am not responsible enough!
    if( self == top ) location = 'index.html?content='+self.location;

    IF you're self.location COULD include ? or & then you'd want to encode it - but i doubt this is likely from what you've posted so far.

    IF you can't use a server side language to handle the incoming parameter 'content' then let me know and i'll show you how to handle the parameter with JS and use it to change the right frame

    Hope this helps

    ---=| If you're going to buy a pet - get a Shetland Giraffe |=---


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts