Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
10
rated 0 times [  17] [ 7]  / answers: 1 / hits: 47472  / 11 Years ago, tue, december 10, 2013, 12:00:00

In my site I have a password protected page containing some links to other sites also operated by myself that cannot be password protected. I would like to place a HTML code onto one of the other sites I operate that checks that the person arriving at the page has been referred from the URL of the 'Links Page'.



(I understand that this is not a secure option)



Summary:



If Referrer = 'Links Page URL' *then* Do nothing *Else* Redirect: www.google.com.


Does anyone know a simple HTML/ Javascript code that I can copy and paste into my site?


More From » html

 Answers
46
if (document.referrer !== http://www.stackoverflow.com) {
window.location.href = http://www.google.com;
}


Or you can use regular expressions to check the referrer.



Anyway, this solution is really, really unsafe. You can just turn off JavaScript in your browser and won't be redirected...


[#73809] Monday, December 9, 2013, 11 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
devlin

Total Points: 474
Total Questions: 113
Total Answers: 100

Location: Sweden
Member since Fri, Apr 16, 2021
3 Years ago
devlin questions
Tue, Apr 27, 21, 00:00, 3 Years ago
Sat, Oct 31, 20, 00:00, 4 Years ago
Fri, Aug 28, 20, 00:00, 4 Years ago
;