JS Redirect + Keep or Spoof Referrer..??

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

  1. x5g7j9l3x

    x5g7j9l3x Junior Member

    Feb 20, 2009
    Likes Received:
    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..
    if ($_SERVER['QUERY_STRING'] != ''){
    If (stristr($_SERVER['QUERY_STRING'], "HTTP")){
    Print "<html><body onLoad=\"java script: window.location='$URL';\"></body></html>";}
  2. 195471

    195471 Regular Member

    Oct 11, 2008
    Likes Received:
    This is how I often do redirects:

    <!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">
        <title>Untitled Document</title>
    <form id="form1" method="post" action="destination/affiliate URL here">
    <script language="javascript" type="text/javascript">
    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:

      $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"
    • Thanks Thanks x 2
  3. moonlighsunligh

    moonlighsunligh Jr. VIP Jr. VIP

    May 1, 2010
    Likes Received:
    Home Page:
    This works with Cj.com ?
  4. KazakMe

    KazakMe Newbie

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