Referrer Script (JavaScript)

I can't really explain the use of this script, a better explanation would be a preview of the script. Remember to change http://yoururl.com/ to a real URL! If you want, you can change the You can only access this page from to your own text.

Here's the code. Put it in your <head> and </head> tags.

<script type="text/javascript">
<!--
var allowedreferrer = "http://yoururl.com/";
  if (document.referrer.indexOf(allowedreferrer) == -1) {
    alert("You can only access this page from " + allowedreferrer);
    window.location=allowedreferrer;
}

//-->
</script>
Top
<--Back | Reload | Forward-->