Conditional Refreshing Page - How To Set A Referrer?
I want to refresh my particular page, when referrer is blank. To do this I used this script: if (document.referrer === '' && document.URL.match('mysite.com/page1/module1
Solution 1:
Try this:
top.location.href = top.location.href;
Instead of this:
window.location.reload();
And it's better to use PHP to make this condition:
<?phpif(!$_SERVER['HTTP_REFERER']) {
echo'<script>top.location.href = top.location.href;</script>';
}
?>
Anyway what you are trying to do is very bad practice, because many people are blocking browser to send referers.
Post a Comment for "Conditional Refreshing Page - How To Set A Referrer?"