homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

how to get referrer from a javascript redirect?
get the referrer url from javascript redirects

 12:06 am on Sep 10, 2008 (gmt 0)

I'm trying to limit access to a page to people coming from a specific domain.
However, that domain is using
to do the redirect and i'm using
if (($_SERVER['HTTP_REFERER'] = "http://www.theirsite.com")
to check it- the result, referrer is blank...

Any ideas how to get the referrer even if its a javascript redirect?



 5:11 am on Sep 15, 2008 (gmt 0)

Don't know if you can. The referrer cannot always be trusted, anyway. Have you found a way around this problem?


 2:30 pm on Sep 15, 2008 (gmt 0)

No, had to check on a variable being present to verify. Not as good, but it works...


 2:40 pm on Sep 15, 2008 (gmt 0)

If the referer is going to be set, it should not matter whether the site is doing a JavaScript redirect, a server-side redirect or the user is clicking a link in the normal way. (?) If the referer is not set, it is likely to be another reason - and out of your control.

Just to note, you only have a single equals (assignment) rather than a comparison (double equals), but then your code would always execute...
if (($_SERVER['HTTP_REFERER'] = "http://www.theirsite.com")

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved