• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 206
  • Last Modified:

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
0
humer2000
Asked:
humer2000
1 Solution
 
rockmansatticCommented:
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
 
humer2000Author Commented:
this is very complicated
i need a simple script
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
pfievCommented:
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
 
humer2000Author Commented:
hi please read my question
i am looking for asp code not php or javascript
0
 
pfievCommented:
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
 
pfievCommented:
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
 
pfievCommented:
Just forgot: redirect your browser by
Response.Redirect("YourPageIE.asp")
0

Featured Post

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!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now