Forum Moderators: open

Message Too Old, No Replies

Redirecting visitors from specific URLs

Redirecting visitors

         

Tiffany

8:35 pm on Oct 27, 2004 (gmt 0)

10+ Year Member



I am trying to find a javascript that will redirect visitors from specific URLs to another URL. Can anyone help. Thanks.

RonPK

11:13 am on Oct 28, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hello Tiffany, welcome to WebmasterWorld [webmasterworld.com]!

The document object has a referrer property. So all you need to do is read that property and redirect the visitor, with

location = "[the other URL]"

The problem with that property is that it is very unreliable: browser settings and firewalls may alter or remove it.

Tiffany

4:11 pm on Oct 28, 2004 (gmt 0)

10+ Year Member



Thanks Ron, I will give that a try.

Tiffany

6:05 pm on Oct 28, 2004 (gmt 0)

10+ Year Member



Hi Ron
Do who know where I can find the javascript?
I found many for redirecting visitors from one page to another page within the website. I would like to direct visitors coming to my site from specific domains to another domain.

RonPK

6:20 pm on Oct 28, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Funny... most webmasters like to keep visitors on their own site ;)

An example:

<script type="text/javascript"> 
if (document.referrer == "[referring URL here]") {
location = "[redirect URL here]";
}
</script>