1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

JS Redirect + Keep or Spoof Referrer..??

Discussion in 'HTML & JavaScript' started by x5g7j9l3x, Oct 2, 2009.

  1. x5g7j9l3x

    x5g7j9l3x Junior Member

    Joined:
    Feb 20, 2009
    Messages:
    127
    Likes Received:
    1
    I have a PHP page that checks the "$_SERVER['QUERY_STRING']" and if detects "http" in the URL string it forwards to that URL using a JS redirect..
    so the referrer looks like "http://my-site.com/?http://stardrifter.org/cgi-bin/ref.cgi"

    "http://stardrifter.org/cgi-bin/ref.cgi" is website that tells you yer referrer..

    But on some browsers like "IE" this method doesn't keep the referrer and it shows up blank..

    So i was wondering if there are any other ways to do a JS redirect that will keep or spoof the referrer for all browsers..??

    This is my PHP-JS redirect code..
    Code:
    <?php
    if ($_SERVER['QUERY_STRING'] != ''){
    
    
    If (stristr($_SERVER['QUERY_STRING'], "HTTP")){
    $URL = $_SERVER['QUERY_STRING'];
    Print "<html><body onLoad=\"java script: window.location='$URL';\"></body></html>";}
    
    
    }
    ?>
    
     
  2. 195471

    195471 Regular Member

    Joined:
    Oct 11, 2008
    Messages:
    417
    Likes Received:
    260
    This is how I often do redirects:

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title>Untitled Document</title>
    </head>
    <body>
    <form id="form1" method="post" action="destination/affiliate URL here">
    <script language="javascript" type="text/javascript">
            document.getElementById('form1').submit();
    </script>
    </form>
    </body>
    </html>
    
    
    I create a web page with the code above (and nothing else), and this is the page that I want the affiliate company or network to see as the referrer. The form's action attribute is an affiliate URL. Then I direct traffic to the URL of the page created above. People will see this page as the referrer, not the page that links to it, which could be something like a forum thread, Hub page, etc. -- whatever your traffic source is that you're trying to hide.

    This method of "redirecting" is actually an automatic form submission using javascript, and it has the advantage of being able to hide your real source of traffic without the risk of showing a blank or leaked referrer.

    Note: I don't directly link to the pages that have the javascript. Instead, I link to a PHP page on a relevant-sounding domain that will send the traffic to the page containing the javascript. So if you have a site about green widgets, and your domain is bestgreenwidgets.com, here's what the flow would look like:

    Some web page (your secret traffic source) --> hxxp://www.bestgreenwidgets.com/go.php?id=whatever --> hxxp://www.NOTyourwidgetsdomain.com/yourjavascriptpage.html --> destination URL

    The site that owns the destination page will see your tracking/redirect domain (hxxp://www.NOTyourwidgetsdomain.com in this example) as the referrer.

    Here's the code for the go.php file:

    Code:
    <?php
      $id = $_GET['id'];
      $links = array(
    	"whatever" => "URL of the page containing the javascript",
            "whatever2" => "URL of another page containing the same JS but with a different destination URL"
        );
    
      header("Location:".$links[$id]);
      exit;
    ?>
    
     
    • Thanks Thanks x 2
  3. moonlighsunligh

    moonlighsunligh Jr. VIP Jr. VIP Premium Member

    Joined:
    May 1, 2010
    Messages:
    1,623
    Likes Received:
    218
    This works with Cj.com ?
     
  4. KazakMe

    KazakMe Newbie

    Joined:
    Jun 11, 2013
    Messages:
    23
    Likes Received:
    4
    So By adding This i can hide my real source of traffic or refferer?and will it work or any site