Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Conditional Redirection

Posted on 1998-09-25
4
Medium Priority
?
223 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Originally, this post was published on Monitis Blog, you can check it here . Websites are getting bigger and more complicated by the day. Video, images and custom fonts are all great for showcasing your product or service. But the price to pay in…
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
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 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)

715 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