Snap Builder Public Codes Library
Snap | Generators | Login | Browse | Search | Enter Code | Export Snap Builder Public Codes Library

 

Category: Javascript Codes Library >> Security >> Specify Referring Page


Code Snippet </> Info


Snippet Name: Specify Referring Page

Description: This script makes sure that your visitor can only reach a given page from the page that you specify.


Compatible Browsers:
Chrome BrowserFirefox BrowserInternet Explorer BrowserOpera BrowserSafari Browser


Example: View Code Demo

Note:

Author: SnapBuilder <snippets@snapbuilder.com>

Last Modified: 2019-12-10 01:08:37

Language: javascript

Highlight Mode: javascript

Copy Codes: Use Free Notepad ++
Bookmark and Share

Snap HTML Code Editor:
Paste the source code, make changes and instantly see it in live preview.
Snap HTML Code Editor


  About Copying
Copied To Clipboard!

<html> <head> <title>Specify Referring Page - Javascript Code Snippet</title> <script> <!-- // Begin Specify Referring Page // == This Script Free To Use Providing This Notice Remains == // // == This Script Has Been Found In The https://snapbuilder.com Free Public Codes Library == // // == NOTICE: Though This Material May Have Been In A Public Depository, Certain Author Copyright Restrictions May Apply == // --> var allowedreferrer = "http://www.yoursite.com/referring_page_name.htm"; if (document.referrer.indexOf(allowedreferrer) == -1) { alert("You can only access this page from " + allowedreferrer); window.location=allowedreferrer; } </script> </head> <body> <p>This script makes sure that your visitor can only reach a given page from the page that you specify.</p> </body> </html>


[ Snippet Options ]

 

© 2002 -  Snap Builder Public Codes Library