Navigation Menu
Alphabetical Listing
Site Contents

Site FAQ
About JSS
JavaScript Forum
JavaScript Tutorial
Friends of JSS

Link to Us
JavaScript Help
Contribute a script
Technology Jobs

Become a Partner

Internet.commerce

Be a Commerce Partner














Internet.com

IT
Developer
Internet News
Small Business
Personal Technology

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers

Developer Channel

FlashKit.com
JavaScript.com
JavaScriptSource
Developer Jobs
ScriptSearch
StreamingMediaWorld
Web Developer's Journal
Web Developer's Virtual Library
WebDeveloper.com
Webreference
Web Hosts
XMLfiles.com

Great Sites

DocJavaScript.com
dhtml.com
The Freebie Directory
TheFreeSite.com

Browse Doc JS's Tips!


Hiermenus Central


Promotions

Free Announcements


Social Bookmark

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.


User Comments

Add a comment, suggestion, or correction
[For questions about usage, consult the Notes tab above or visit the JavaScript forum. Do not include more than two (2) lines of code in your comments. If you have suggestions or corrections, you can submit them to us.]

    
   
       
[optional]
 
[optional]

   

Comments feed Comment Feed RSS 2.0

3. From: John
Great little script!
01/14/2008 07:27:35

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

1. From: Christopher Parker
Server-side Only
01/07/2008 11:58:38

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.

2. From: Lee Underwood (Admin)
01/29/2008 12:34:41

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.


Do you write JavaScripts?
If you do, why not submit them to us?
We'll give you credit and a link back to your Web site.