Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I restrict access based on referring domain? 1

Status
Not open for further replies.

hazelnut

Programmer
Feb 14, 2001
1
I need to restrict access to a website so that users can only come from a specific domain (e.g. I figured out how to restrict users coming from a specific URL (e.g. but not at the domain level. Also once users are in my website, I need to allow them to move around freely as well and not have them restricted because they are no longer coming from the domain mentioned above.

Thanks a lot!
 
you can use document.referrer or soemthing like that and parse the string out so you only grab the domain by splitting on the slash:

thereferringdomain=document.referrer.split["/"][0] jared@aauser.com -
 
I have been trying this - but my referrer property is always empty - even when I linked to my test page - is this something to do with local testing, like when the url starts "file"? Otherwise no trubs. Got any clues? bj
b2 - benbiddington@surf4nix.com
 
oops, that should be:

thereferringdomain=document.referrer.split("//")[1].split("/")[0]


got my domain for my test :) jared@aauser.com -
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top