Specify Referring Page | JavaScriptSource

Specify Referring Page

Katherine Nolan Jan 7, 2008

General

Use this script to ensure that a user can only reach a given page from another specified page. Easy to set-up and use.


Notes

Source Code

Paste this source code into the designated areas.

External file

Paste this code into an external JavaScript file named: specifyReferringPage.js


Head

Paste this code into the HEAD section of your HTML document.


Leave a Response

(3 comments)

Yes, Christopher, you're correct. These things should be handled by server-side scripts. However, as you mentioned, it is useful for those who do not have access to server-side scripts.

Lee Underwood Jan 29, 2008

Had thought of doing that myself.. but never got round to it. Thanks for sharing. John.

John Jan 14, 2008

Nice script. However, if it's vitally important that a user is referred from a specific domain name, this sort of test is best left to a server-side language. This restriction can easily be bypassed by disabling JavaScript in the browser. Additionally, the referrer is not available on the client side, as it's populated in the document's HTTP headers by the Web server. The solution is nice if you don't have server-side scripting available to you, but then again, if it's actually important to you that the user comes from a specific domain, you should really look into a better Web host that will provide server-side scripting.

Christopher Parker Jan 7, 2008