473,394 Members | 1,813 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,394 software developers and data experts.

detecting domain re-direction

Can anyone help. I'm new to Javascript so be gentle.

I have 2 registered domains which are set up to redirect to my homepages
which are on a different ISP. I have been told that it is possible to use
Javascript to detect which domain name the viewer has come from and then
switch to a different index.htm page accordingly. I have tried searching
assorted archives, but can't get anything working.
Dave
Jul 23 '05 #1
1 1203
Dave Parkinson wrote:
Can anyone help. I'm new to Javascript so be gentle.

I have 2 registered domains which are set up to redirect to my homepages
which are on a different ISP. I have been told that it is possible to use
Javascript to detect which domain name the viewer has come from and then
switch to a different index.htm page accordingly.
Only if they have scripting enabled.
I have tried searching assorted archives, but can't get anything working.

<script type="text/javascript">
if (document.referrer && document.referrer="http://www.mydomain1.com/"){
window.location = "http://www.myotherdomain.com/page1.html"
}
else{
window.location = "http://www.myotherdomain.com/page2.html"
}

Note that document.referrer returns an empty string in IE when tested
offline.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Jul 23 '05 #2

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

Similar topics

4
by: Charles | last post by:
Hi, I have a site that has several domains pointing to its DNS. I would like to implement a script that will grab the domain name visitors typed in, and display it on the page. Is there a way to...
2
by: Gary W | last post by:
I want to redirect users who DO NOT SUPPORT sessions to another page. Think this will work? PSEUDO CODE: ------------------------------------------------------------------- <asp vbscript>...
2
by: Halldór Ísak Gylfason | last post by:
In my application I have an iframe that is empty (and not visible) initially, however when a user presses a button a form is programmatically submitted and the target is set to the IFrame. I...
1
by: Lee | last post by:
Hi, Is it possible to detect whether a user is logged into a Win2000/2003 domain? I'm writing a VB.NET app and require this functionality within it. Any help would be greatly appreciated. ...
1
by: Damon Morbius | last post by:
Is there a standard way to detect the device a visitor is using to access your site (i.e. Cell phone, handheld, web browser). Ultimately my goal is to detect what kind of device a visitor is using...
1
by: Luthor | last post by:
Hi, Say I'm on the site www.xyz.com and on a certain page if the user leaves the domain xyz.com, I have a popup cme up w/ stuff. I don't need to know what the new domain is, I just want to know...
6
by: Andrea | last post by:
I need to detect when another application is launched. I'd need to know also when a new folder is opened in explorer. I'm developing an application to speed up access to frequently used...
3
by: andrew sargent | last post by:
Hi, I have two domain names pointing to the same webspace, but i want them to be directed to seperate directories on the server: www.web1.com -> dir "Web1" www.web2.com -> dir"Web2" The...
79
by: VK | last post by:
I wandering about the common proctice of some UA's producers to spoof the UA string to pretend to be another browser (most often IE). Shouldn't it be considered as a trademark violation of the...
1
by: Roshan | last post by:
Hi, I wanted a reliable way of detecting if a given NTAccount object represents a user account or group account. I was using SecurityIdentifier.IsAccountSid() method but this doesn't work as I...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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...

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.