I'm using this to check if someone came from Reddit, however it doesn't work.
var ref = document.referrer;
if(ref.match("/http://(www.)?reddit.com(/)?(.*)?/gi"){
alert('You came from Reddit');
}
else{
alert('No you didn\'t');
}
Suggestions on the regular expression are most welcome too ;)