Solved

Detect MACINTOSH and Netscape Navigatoir via ASP

Posted on 2004-09-10
8
186 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
 
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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

This article covers the basics of the Sass, which is a CSS extension language. You will learn about variables, mixins, and nesting.
Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

758 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now