Results 1 to 7 of 7

Thread: Site Referrer

  1. #1
    Join Date
    Sep 2002
    Bohol, Philippines

    Site Referrer

    For example, I have a domain Then another site points to my site used framesets so that my official site,, will not appear on the address bar.

    How can I create a script that will check that if the referrer is, my site will override his frameset and will display instead at the address bar?

    I created a PHP script by evaluating if http_referrer is equal to, then use header("Location:"). But the problem is will still appear on the address bar. I think header("Location:") creates a window on the parent window itself.

    Is there another script to do this? I think this can be done using PHP.


  2. #2
    Join Date
    May 2005
    Roanoke, VA
    Even better, why not drop in a bit of JavaScript to check whether your site is being displayed inside a frameset, and break out if it is? A quick Google search for "break frameset script" turns up some likely candidates, including this one which seems to be exactly what you need.

    This way, if they get another domain or if another site starts doing the same thing, you dont' need to change anything.
    You cooin' with my bird?

  3. #3
    Join Date
    Mar 2004
    yah, that's how i use it for some websites.

    javascript will do

  4. #4
    Join Date
    May 2005
    Scranton, PA
    Location is a HTTP protocol header not specific to php, browsers redirect to that page and should update in the url bar.

    Something else may be going on, like inside frames as people are talking about.
    Senior Software Developer
    BurstNET® - The Speed the Internet Travels™
    BurstNET® - an INC500™ Company -

  5. #5
    I believe using window.location='' in the body's onload event will override the frames. If not, the link attribute that you want is target="_top".

  6. #6
    if you're using php, you shouldn't use the "location" header. instead use refresh.
    PHP Code:
    header("Refresh: 1; url='http://url.ext'"); 
    everyday is deadline

  7. #7
    Join Date
    Sep 2002
    Bohol, Philippines
    Thanks guys!

    I used the javascript from the link given by ubernostrum and it perfectly worked!

    here's the simple code for the info of the others:
    // (C) 2000
    // Free for all users, but leave in this  header
    if (parent.frames.length > 0) {
        parent.location.href = self.document.location
    I will try also the PHP code by bloodyveins. thank again.

Posting Permissions

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