473,326 Members | 2,102 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

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.referrer

if(previousDomain.indexOf("btinternet.com") > -1)
{
window.location="update.htm"
}
}
</script>

</HEAD>

....snip.....

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

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

Best wishes

Paul
Jul 20 '05 #1
1 4745
Hello

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

Does this help?

http://devedge.netscape.com/library/...3/reference/do
cument.html#1193980

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

Mark

"Paul Lee" <pa**@paullee.com> wrote in message
news:cf**************************@posting.google.c om...
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.referrer

if(previousDomain.indexOf("btinternet.com") > -1)
{
window.location="update.htm"
}
}
</script>

</HEAD>

...snip.....

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

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

Best wishes

Paul

Jul 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Damo | last post by:
Could someone please help me. I am a newbie at PHP. I downloaded formail.php Version 5.0 from Jacks scripts( http://www.dtheatre.com/scripts/ )and changed the required areas to my email address and...
3
by: Mr B | last post by:
Howdy all, I have 2 domain names that both go to the same website. For example, if www.XXXX.com is the primary name for the website, if you type in www.XXXX.com or www.YYYY.com, they both go...
3
by: RTL | last post by:
Hello all, Actually, we're letting several of our domain names go back into the field. I believe there must be some industry way to use some HTML element/tag to get the Spiders to start updating...
9
by: postings | last post by:
Just a quick question... When I do a "response.redirect" from a source webpage to a destination webpage, does the code on the source webpage carry on executing unless I put a "response.end"...
4
by: surfivor | last post by:
I have a simple problem in that I have developed various websites off of my domain such as: www.mydomain.com/my-friends-website I want to be able to have someone register a domain such as ...
2
by: Smokey Grindel | last post by:
Right now I am posting data to a webpage by doing the following webRequest = CType(System.Net.WebRequest.Create("http://www.domain.com/login.asp"), Net.HttpWebRequest) webRequest.Method =...
9
by: RN1 | last post by:
When a server encounters the line Response.Redirect("abcd.asp") in a ASP script, the server tells the browser that it has to be redirected to another page (which is abcd.asp, in this case)....
6
by: =?Utf-8?B?YzY3NjIyOA==?= | last post by:
Hi all, We have two sites hosted on different servers and we have many pages on domain A which has many links(asp programs) to domain B. My question is if domain B server is in trouble, what is...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.