Solved

Detect MACINTOSH and Netscape Navigatoir via ASP

Posted on 2004-09-10
8
192 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
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 15

Expert Comment

by:joeposter649
ID: 12029143
0
 
LVL 1

Author Comment

by:humer2000
ID: 12038343
this is very complicated
i need a simple script
0
Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
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 500 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone 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

It's sometimes a bit tricky to use date functions in Oracle BPEL. I'll explain quickly how you can add N days to the current date. In a BPEL process this can be useful, and you can adapt it to fit your needs. First of all, let's see how to add 1 …
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.
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)
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…

856 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