SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Zealot
    Join Date
    Apr 2005
    Location
    Helsingborg, Sweden
    Posts
    168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Redirecting within a frame for the top URL

    I use a hidden frame on one of my pages to show (hide) some content. I'd like this hidden frame to be able to do some error checking and redirect the top page to my given URL with the header command.
    PHP Code:
    header("Location: somepage.php");
    die; 
    But this only redirects the frame itself but no the top page. How do I solve this?

  2. #2
    Tranceoholic lilleman's Avatar
    Join Date
    Feb 2004
    Location
    Írebro, Sweden
    Posts
    2,716
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    You can't do this using PHP since frames are client-side, and PHP is server-side.
    You'll have to use a client-side language such as Javascript to redirect the user:

    PHP Code:
    echo '<script type="text/javascript">',
         
    'top.location.href = \'somepage.php\';',
         
    '</script>'; exit; 
    ERIK RIKLUND :: Yes, I've been gone quite a while.

  3. #3
    SitePoint Zealot
    Join Date
    Apr 2005
    Location
    Helsingborg, Sweden
    Posts
    168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the quick reply. Never thought about frames as client-sided before. Anyway, problem solved...

  4. #4
    SitePoint Zealot
    Join Date
    Apr 2005
    Location
    Helsingborg, Sweden
    Posts
    168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    A follow-up question. Is it possible to access the $_GET variables of the top URL in a frame or is it the same thing there with the frames being clientsided and just shows a page within a page?
    Is it possible to access the $_GET variables of any other URL than that belonging to the scripts own page?

  5. #5
    SitePoint Evangelist djdykes's Avatar
    Join Date
    Feb 2005
    Location
    Chester, Cheshire
    Posts
    566
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    have you tried getting the variables through $_REQUEST ?


Bookmarks

Posting Permissions

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