Skip to content

Instantly share code, notes, and snippets.

/hide_referrer.php

Created May 20, 2015
Embed
What would you like to do?
Hide referrers with Keitaro TDS. Just place file hide_referrer.php with code below to application/redirects/
<?php
/**
* @redirectName HIDE REFERER
* @redirectWeight 100
*/
class hide_referrer_redirect extends AbstractRedirect2
{
public function go(Stream $stream, Visitor $visitor)
{
$this->setContent($this->_gethideRedirect($stream, $visitor));
}
private function _gethideRedirect(Stream $stream, Visitor $visitor)
{
$code = '<script>
function go() {
window.frames[0].document.body.innerHTML = \'<form target="_parent" method="post" action="' . $stream->getUrlWithParams($visitor) . '"></form>\';
window.frames[0].document.forms[0].submit()
}
</script>
<iframe onload="window.setTimeout(\'go()\', 99)" src="about:blank" style="visibility:hidden"></iframe>';
return $code ;
}
public function goDebug(Stream $stream, Visitor $visitor)
{
return "Redirecting to: " . $stream->getUrlWithParams($visitor);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.