Thread: javascript
View Single Post
Old 04-16-2014, 07:00 AM  
sarettah
see you later, I'm gone
 
Industry Role:
Join Date: Oct 2002
Posts: 14,055
Quote:
Originally Posted by rosx View Post
sarettah this worked with me just after doing little change


Code:
if (document.referrer.indexOf('https://gfy.com/') > -1)
    {
     window.location='http://yahoo.com';
}
else if (document.referrer.indexOf('https://gfy.com/forum') > -1)
    {
     window.location='http://msn.com';
}
else 
  {
     window.location='http://www.google.com';
}
Well, it appears to me that you will never send anyone to msn.com with that.

Your first condition document.referrer.indexOf('https://gfy.com/') > -1 should send anyone from gfy to yahoo. Since the second condition also includes the first condition it will never be hit.

So, if you wanted to do that switch condition 1 and 2 around. Make condition 1 be gfy.com/forum and condition 2 be just gfy. That way the ones to the forums will be redirected to msn and then anyone else from gfy will be redirected to yahoo.

I had done the exact match conditions because you had included specific pages in your example. As I said, it was a very simple version.

Glad it worked for you.

.
__________________
All cookies cleared!
sarettah is online now   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook