Solved

Conditional Redirection

Posted on 1998-09-25
4
213 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. 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.: (CODE)

747 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

13 Experts available now in Live!

Get 1:1 Help Now