Redirect someone from a referring domain to a webpage

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Paul Lee

    Redirect someone from a referring domain to a webpage

    Hi all,
    I'm trying to redirect users from a specific domain to one of my
    webpages.
    So, in my example, anyone accessing my index.html from the
    *btinternet.com domain (allowing for wildcards!) will be redirected to
    "update.htm ".

    I'm not bothered what the referring webpage was, I'm just interested
    in
    anyone accessing my page from a certain domain

    This is what I have:

    <HTML>

    <HEAD>
    <script type="text/javascript">
    function redirect()
    {
    previousDomain = document.referr er

    if(previousDoma in.indexOf("bti nternet.com") > -1)
    {
    window.location ="update.htm "
    }
    }
    </script>

    </HEAD>

    ....snip.....

    <BODY bgcolor="FFFFFF " TEXT="000000" LINK="00FF00"
    onload="redirec t()">

    ......snip..... .


    but it doesn't want to work.... what have I done wrong?

    Best wishes

    Paul
  • Guest's Avatar

    #2
    Re: Redirect someone from a referring domain to a webpage

    Hello

    It looks OK. If you do an alert of document.referr er, do you see what you
    expect?

    Does this help?


    cument.html#119 3980

    You should convert the referrer to lower (or upper) case before attempting
    comparisons:
    document.referr er.toLowerCase( );

    Mark

    "Paul Lee" <paul@paullee.c om> wrote in message
    news:cf49715f.0 312040316.65471 0ab@posting.goo gle.com...[color=blue]
    > Hi all,
    > I'm trying to redirect users from a specific domain to one of my
    > webpages.
    > So, in my example, anyone accessing my index.html from the
    > *btinternet.com domain (allowing for wildcards!) will be redirected to
    > "update.htm ".
    >
    > I'm not bothered what the referring webpage was, I'm just interested
    > in
    > anyone accessing my page from a certain domain
    >
    > This is what I have:
    >
    > <HTML>
    >
    > <HEAD>
    > <script type="text/javascript">
    > function redirect()
    > {
    > previousDomain = document.referr er
    >
    > if(previousDoma in.indexOf("bti nternet.com") > -1)
    > {
    > window.location ="update.htm "
    > }
    > }
    > </script>
    >
    > </HEAD>
    >
    > ...snip.....
    >
    > <BODY bgcolor="FFFFFF " TEXT="000000" LINK="00FF00"
    > onload="redirec t()">
    >
    > .....snip......
    >
    >
    > but it doesn't want to work.... what have I done wrong?
    >
    > Best wishes
    >
    > Paul[/color]


    Comment

    Working...