Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Conditional Redirection

Posted on 1998-09-25
4
Medium Priority
?
229 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 400 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

This article discusses four methods for overlaying images in a container on a web page
This article discusses how to create an extensible mechanism for linked drop downs.
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…

916 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