Solved

Conditional Redirection

Posted on 1998-09-25
4
214 Views
Last Modified: 2010-04-09
I would like a comprehensive understanding of the conditions under which I can redirect a visitor to another page.

I am aware of unconditional redirection such as the META|REFRESH, and conditional redirection such as NO FRAMES (if visitor's browser doesn't support frames) or NO SCRIPT (if visitor's browser doesn't support Javascript).

I beleive there are ways to redirect based on other conditionals, such as browser version.  Are there other conditionals, such as the visitor's domain name, on which I can base an automatic link to a designated page?
0
Comment
Question by:bizware
  • 2
4 Comments
 

Author Comment

by:bizware
ID: 1838155
Edited text of question
0
 
LVL 4

Expert Comment

by:martinag
ID: 1838156
To redirect depending on browser:
if (navigator.appName.indexOf("Netscape") != -1)
  location.href = "netscape.htm";
if (navigator.appName.indexOf("Microsoft") != -1)
  location.href = "ie.htm";
else
  location.href = "otherbrowser.htm";

Martin
0
 
LVL 4

Expert Comment

by:martinag
ID: 1838157
Forgot to mention...the code I posted i JavaScript.
Use it like this:
<SCRIPT LANGUAGE="JavaScript">
<!--
if (navigator.appName.indexOf("Netscape") != -1)
  location.href = "netscape.htm";
if (navigator.appName.indexOf("Microsoft") != -1)
  location.href = "ie.htm";
else
  location.href = "otherbrowser.htm";
// -->
</SCRIPT>
0
 
LVL 8

Accepted Solution

by:
jbirk earned 200 total points
ID: 1838158
Martinag is right that you can base it on browser, but you can use a much more exhaustive list than just netscape microsoft.  There's also the version numbers, and then there's opera, and a few other strage ones.
And of course you can redirect based on screen resolution, colors, and a few more thing that you can check.  All of this is done via javascript.  Some other means may be possible, but JavaScript is the most browsewr compatible method.
Also, you mentioned:  "visitor's domain name" and this cannot be done via javascript, but I think Java may have access and there are ways for javascript and java to communicate.  But when trying to determine domain name or ip address, I use cgi/perl which does a nice job.

If you wanted to use one of these methods or had something specific in mind I can provide code for you.
-Josh
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses how to create an extensible mechanism for linked drop downs.
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
In this tutorial viewers will learn how to style transparent/translucent elements using alpha transparency in CSS Start with a normal styled element, such as a div.: Define its "background-color" property as "rgba (255, 255, 255, .5): The numbers in…
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now