Link to home
Start Free TrialLog in
Avatar of humer2000
humer2000

asked on

Detect MACINTOSH and Netscape Navigatoir via ASP

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
Avatar of rockmansattic
rockmansattic

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

Avatar of humer2000

ASKER

this is very complicated
i need a simple script
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
hi please read my question
i am looking for asp code not php or javascript
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...
ASKER CERTIFIED SOLUTION
Avatar of pfiev
pfiev

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Just forgot: redirect your browser by
Response.Redirect("YourPageIE.asp")