Results 1 to 7 of 7

Thread: [Request] If not in frameset, go to a URL?

  1. #1
    Join Date
    Mar 2007
    Posts
    68
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Question [Request] If not in frameset, go to a URL?

    I am making a site, but I have no domain name at current. So I am using "www.co.nr" which hides your site in a frameset.

    I wish to make it on my homepage, index.php, if it is not in the Frameset, it wall automatically redirect to the Framesetted page.

    Example:
    www.RandomURL.co.nr is frameset to "www.mysite.com/index.php".
    I wish to make it when you go to "www.mysite.com/index.php" it will automatically go to www.RandomURL.co.nr with the frameset. I hope you understand what I mean :P

  2. #2
    Join Date
    Jul 2006
    Location
    just north of Boston, MA
    Posts
    1,806
    Thanks
    13
    Thanked 72 Times in 72 Posts

    Default

    so basically you want to check what the URL Address of the page is, and if it is not the framed page you want to redirect to the framed page?

    what language? Javascript / PHP / ASP ??? A server side program would be best because anyone can disable javascript on the client side and thus the redirect will not happen, but with php / asp or some other type of server side programming language the processing takes place before the page is sent back to the browser.

    since you are using framed pages, I am going to assume you do not have access to a server-side language so the script below would need to be included on every page that you wish to check.

    Code:
    <script type="text/javascript">
    if(top.location.href != "http://www.RandomURL.co.nr")
    {
         top.location = "http://www.RandomURL.co.nr";
    }
    </script>

  3. #3
    Join Date
    Mar 2007
    Posts
    68
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default

    Thanks

    It's a php page btw, so anything would have worked

  4. #4
    Join Date
    Jul 2006
    Location
    just north of Boston, MA
    Posts
    1,806
    Thanks
    13
    Thanked 72 Times in 72 Posts

    Default

    why are you using framesets if you have access to php?

    I would suggest that you include the basic pages like (header, footer, navbar) and just do your processing on the "content" portion?


    but as for your question since you have access to php.... I would use this instead

    PHP Code:
    <?php

    if( $_SERVER['HTTP_HOST'] != "http://www.RandomURL.co.nr" )
    {
         
    header("Location: http://www.RandomURL.co.nr");
    }


    rest of page
    ?>

  5. #5
    Join Date
    Mar 2007
    Posts
    68
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default

    Tried an include, it glitches up. Not sure why, but if I use an include, it completely ignores the include.

  6. #6
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Don't do this, it's an accessibility nightmare. Let your users break out of your frameset if they want to.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  7. #7
    Join Date
    Mar 2007
    Posts
    68
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default

    This is only until my host, my friend, gets his host to sort of php includes. Once he does that I'm fine, and I'll sort it.

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
  •