Posted By

apphp-snippets on 02/13/13


javascript page referring

Versions (?)

Specify Referring Page in JavaScript

 / Published in: JavaScript


This script informs your visitor that a given page may be reached only from the page that you specify. Paste this code before the ending tag on the page:

  1. <script type="text/javascript">
  2. var allowed_referrer = "";
  3. if(document.referrer.indexOf(allowed_referrer) == -1){
  4. alert("You can access this page only from " + allowed_referrer);
  5. window.location = allowed_referrer;
  6. }
  7. </script>

Report this snippet  

You need to login to post a comment.