Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 10-12-2009, 02:42 PM   PM User | #1
thelaughingman
New to the CF scene

 
Join Date: Oct 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
thelaughingman is an unknown quantity at this point
Referrer checker question

I have used this script successfully:

http://www.javascriptkit.com/script/...2/refer2.shtml

However, is there a way to block the following work-around (example only):

http://www.their-url.com/redir.php?u...ww.my-url.com/

The redir.php makes it possible to get past the script.
thelaughingman is offline   Reply With Quote
Old 10-12-2009, 10:33 PM   PM User | #2
Old Pedant
Supreme Master coder!

 
Old Pedant's Avatar
 
Join Date: Feb 2009
Posts: 23,168
Thanks: 59
Thanked 3,993 Times in 3,962 Posts
Old Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to all
No.

And indeed you can't even guarantee that a *normal* client will give you a valid HTTP_REFERER value. Some people sit behind proxies or firewalls that are so paranoid that they won't send the referer value. You have to treat referer as a "friendly thing to have when it works" but you should *never* rely upon it.

And don't forget search engines: They don't provide referer info, but you surely don't want to cut them off.
Old Pedant is offline   Reply With Quote
Old 10-15-2009, 05:47 AM   PM User | #3
thelaughingman
New to the CF scene

 
Join Date: Oct 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
thelaughingman is an unknown quantity at this point
No, I'm just trying to block or at least make it difficult for harassing websites to link directly to my blog.
thelaughingman is offline   Reply With Quote
Old 10-15-2009, 08:03 PM   PM User | #4
Old Pedant
Supreme Master coder!

 
Old Pedant's Avatar
 
Join Date: Feb 2009
Posts: 23,168
Thanks: 59
Thanked 3,993 Times in 3,962 Posts
Old Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to all
So go ahead and check the referrer.

But I would say that, if the referrer is blank, you should allow the access. Just as a for-instance, it will be blank if the user clicked on an entry in his/her "favorites".

Now, that does mean that it's trivial for hackers to give you a blank referrer, but for the reasons I already noted there's not much you can do about that, anyway.
Old Pedant is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 12:26 PM.


Advertisement
Log in to turn off these ads.