?
Solved

Detect MACINTOSH and Netscape Navigatoir via ASP

Posted on 2004-09-10
8
Medium Priority
?
204 Views
Last Modified: 2010-04-06
Hi

I knwo that we we can detect MAC and Netscape navigators and redirect them to specifi pages, all this via javascript

I would like to knwo if we can do this in asp (active server pages)

If yes, please give me an example with redirection to A or B page
0
Comment
Question by:humer2000
[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
8 Comments
 
LVL 10

Expert Comment

by:rockmansattic
ID: 12025982
Will this work for you?

request.servervariables("HTTP_USER_AGENT")

my results are

Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)

Rockman

0
 
LVL 1

Author Comment

by:humer2000
ID: 12038343
this is very complicated
i need a simple script
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Expert Comment

by:pfiev
ID: 12038919
This (from phpBB2 skin) detect PC/Mac and IE/NS:

var clientPC = navigator.userAgent.toLowerCase(); // Get client info
var clientVer = parseInt(navigator.appVersion); // Get browser version

var is_ie = ((clientPC.indexOf("msie") != -1) && (clientPC.indexOf("opera") == -1));
var is_nav = ((clientPC.indexOf('mozilla')!=-1) && (clientPC.indexOf('spoofer')==-1)
                && (clientPC.indexOf('compatible') == -1) && (clientPC.indexOf('opera')==-1)
                && (clientPC.indexOf('webtv')==-1) && (clientPC.indexOf('hotjava')==-1));

var is_win = ((clientPC.indexOf("win")!=-1) || (clientPC.indexOf("16bit") != -1));
var is_mac = (clientPC.indexOf("mac")!=-1);

So just test is_ie, is_nav, is_win, is_mac and use location.href = "yourpage.htm" to redirect
0
 
LVL 1

Author Comment

by:humer2000
ID: 12038999
hi please read my question
i am looking for asp code not php or javascript
0
 
LVL 1

Expert Comment

by:pfiev
ID: 12039085
oh sorry, I've just read so fast and I saw something 'javascript' :-)
But both have the same approach: read USER_AGENT (here in ASP is request.servervariables("HTTP_USER_AGENT")) then test some specified pieces of text. If you find 'mac' then it's Mac, or 'win' then it's Windows...
0
 
LVL 1

Accepted Solution

by:
pfiev earned 1500 total points
ID: 12039126
ASP version of the script below:

strUA = LCase(Request.ServerVariables("HTTP_USER_AGENT"))
if (InStr(strUA, "msie") AND NOT InStr(strUA, "opera")) then
     is_ie=true
end if
...
if (InStr(strUA, "mac")) then
     is_mac=true
end if
....
0
 
LVL 1

Expert Comment

by:pfiev
ID: 12039131
Just forgot: redirect your browser by
Response.Redirect("YourPageIE.asp")
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

There are two main kinds of selectors in CSS: One is base selector like h1, h2, body, table or any existing HTML tags.  For instance, the following rule sets all paragraphs (<p> elements) to red: (CODE) CSS also allows us to define our own custom …
JavaScript has plenty of pieces of code people often just copy/paste from somewhere but never quite fully understand. Self-Executing functions are just one good example that I'll try to demystify here.
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Suggested Courses

762 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