Redirect on specific referrer url

Learn the basics of how to exploit JavaScript.

Redirect on specific referrer url

Post by Frogger81 on Sat Mar 26, 2011 6:04 am
([msg=55560]see Redirect on specific referrer url[/msg])

I am looking for a javascript that will redirect if the visitor is coming from a certain url.

If you could give it to me understanding that I am a beginner I would appreciate it.

Basically I need the webpage to to a meta refresh or redirect to a new page if the visitor is coming from a specific url.

So if there was a link on this post to my webpage, it would redirect to google if the visitor came ftom this url,

posting.php?mode=post&f=21


I have adwords coupons and can make a small paypal deposit for your time.
Frogger81
New User
New User
 
Posts: 3
Joined: Thu Mar 24, 2011 3:54 pm
Blog: View Blog (0)


Re: Redirect on specific referrer url

Post by Gatito on Sat Mar 26, 2011 9:03 am
([msg=55564]see Re: Redirect on specific referrer url[/msg])

Basically if user came from Site A to your Site B he should go to Site C:

Do you owns Site A? If so, when a user clicks on a link that points to Site B you should write the URL like this http://www.siteB.com/?fromsiteA=1 and add JavaScript at the beginning of Site B to look for the fromsiteA=1 part and take appropriate action.


Another way is using PHP. What you do is use the HTTP_REFERER like this:

$previous_url = $_SERVER['HTTP_REFERER'];

Then you take the appropriate action in regards to what $previous_url contains.
User avatar
Gatito
Poster
Poster
 
Posts: 113
Joined: Tue Mar 08, 2011 12:55 pm
Blog: View Blog (0)



Return to Javascript

Who is online

Users browsing this forum: No registered users and 0 guests

cron