473,569 Members | 2,772 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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
Jul 20 '05 #1
1 4755
Hello

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

Does this help?

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

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

Mark

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

Jul 20 '05 #2

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

Similar topics

1
7982
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 the domain server address. (these changes were in the $recipient and $referers section) I have set up the form and can get the form to email me the...
3
5354
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 www.XXXX.com for the same website jsut via different names. What I want to do is take one of those, and redirect them to a sub folder. So if someone...
3
2597
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 their links to our main site for the remainder of the domain's life. I have found this meta element/tag, but that doesn't help with what we want...
9
1975
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" straight the "response.redirect" command? I know about server.transfer BTW, I just want to know what happens in this instance... Many thanks!
4
2956
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 www.somedomain.com and have it point to --www.mydomain.com/my- friends-website
2
1783
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 = "POST" webRequest.CookieContainer = Cookies
9
4332
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). The browser then makes a new request to the server to redirect itself to abcd.asp after which the user gets redirected to abcd.asp. But in case of...
6
2966
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 the best way to have all domain pages redirect to domain A? Right now I just have redirect code in each program on domain B to redirect to a...
0
7694
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7609
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7921
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7964
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6278
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
3636
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2107
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1208
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
936
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.