开发者

Track HTTP Referrer

I have a file called: refdes2.php

<script>
  function go(){
    window.frames[0].document.body.innerHTML='<form target="_parent" action="http://www.site.com/refdes3.php"></form>';
    window.frames[0].document.forms[0].submit()
  }    
</script>
<iframe onload="window.setTimeout('go()', 99)" src="about:blank" style="visibility:hidden"></iframe>

Then this other file: refdes3.php

    <?php
$reftest = $_SERVER['HTTP_REFERER'];
$browser = $_SERVER['HTTP_USER_AGENT'];
if ($reftest != "") { ?>
<script>
  function go(){
    window.frames[0].document.body.innerHTML='<form target="_parent" action="http://www.site.com"></form>';
    window.frames[0].document.forms[0].submit()
  }    
</script>
<iframe onload="window.setTimeout('go()', 99)" src="about:blank" style="visibility:hidden"></iframe>
<?php

}
else {
?>

<script>
  function go(){
    window.frames[0].document.body.innerHTML='<form target="_parent" action="http://www.site.com/refdes4.php"></form>';
    window.frames[0].document.forms[0].submit()
  }    
</script>
<iframe onload="window.setTimeout('go()', 99)" src="about:blank" style="visibility:hidden"></iframe>
<?php
}
?>
开发者_StackOverflow中文版

But still with google analytics some referrer traffic leaks out to refdes4.php .

I guess a different way to track http referrer ( more accurate like google analytics) could do the thing.

Thank You!

if ($reftest != "") { ?>

Says that only if the http referrer is blank, it'll allow it to pass. Else nope.

I want it to go 100% clean blank http referrer traffic. ( some browsers don't blank it ). Currently it's 70% clean traffic. 30% gets leaked.

An alternative to tracking if http referrer is blank (more accurate like google analytics) could be the thing i'm looking for.


So you’re trying to hide the HTTP-Referrer data by using a form, an iframe and its src attribute and javascript?

Well, you are dependant on both then. Browsers may or may not allow setting and overwriting the http referrer with the src attribute of an iframe. You can not hide the referrer in all cases and for 100% sure at all.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜