SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Evangelist jazztie's Avatar
    Join Date
    Mar 2001
    Location
    the Netherlands
    Posts
    519
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Check if page is loaded in frame

    I have a site which consists of 2 frames. 'menu' and 'content'. After typing the normal address the frameset is called from the index-page. Simple enough.

    However: sometime links can contain the link to the right-frame. But the information in the right-frame can't do without the info in the left frame. (as this is a menu)...

    Now: what I want:
    I would like a check in the content-page which checks if the page itself is loaded in the frameset (OKAY!) OR if it is loaded by itself: NOT OKAY. If it's not okay, I would like to reload the page WITH the frameset and the content-page with the right info.


    Example:
    normal situation:
    link to index.php >> loads menu.php and content.php?linkid=1

    link to content.php >> should load index.php

    link to content.php?linkid=100 >> should load menu.php and content.php?linkid=100

    Can anyone help me? Show me how this is done? I can't find the code online. Any help is appreciated!

    Jazz

  2. #2
    SitePoint Guru dale_burrell's Avatar
    Join Date
    Aug 2002
    Location
    Wellington, New Zealand
    Posts
    861
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
    <script>
    <!-- // Loads the frame if someone loads this instead.
    if(parent.location.href == self.location.href) { window.location.href = 'index.html'; }
    //-->
    </script>
    If you aren't living life on the edge
    - you're taking up too much space
    Creative Dreaming Ltd / Ask The Local / Amanzi Travel


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
  •