MAC IE Detection

They have: 218 posts

Joined: Apr 2001

Hi there,

Looking for a reliable script to detect MAC IE browser...javascript and/or PHP. Thanks,

TM

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

http://www.google.com/search?q=javascript+browser+detect+mac+ie

Basically you need to check two things to determine whether it's a mac or not.

http://webreference.com/tools/browser/javascript.html seems to be the best and most robust of the bunch.

They have: 218 posts

Joined: Apr 2001

Thanks. For scripts as light as these, it's nice not to have to do a Google search. This does one check for the OS:

// get browser
if (ereg( 'MSIE ([0-9].[0-9]{1,2})',$HTTP_USER_AGENT,$log_version)) {
$BROWSER_VER=$log_version[1];
$BROWSER_AGENT='IE';

} elseif (ereg( 'Opera ([0-9].[0-9]{1,2})',$HTTP_USER_AGENT,$log_version)) {
$BROWSER_VER=$log_version[1];
$BROWSER_AGENT='OPERA';
} elseif (ereg( 'Mozilla/([0-9].[0-9]{1,2})',$HTTP_USER_AGENT,$log_version)) {
$BROWSER_VER=$log_version[1];
$BROWSER_AGENT='MOZILLA';
} else {
$BROWSER_VER=0;
$BROWSER_AGENT='OTHER';
}

/*
get platform
*/

if (strstr($HTTP_USER_AGENT,'Win')) {
$BROWSER_PLATFORM='Win';
$winOS = true;
} else if (strstr($HTTP_USER_AGENT,'Mac')) {
$BROWSER_PLATFORM='Mac';
} else if (strstr($HTTP_USER_AGENT,'Linux')) {
$BROWSER_PLATFORM='Linux';
} else if (strstr($HTTP_USER_AGENT,'Unix')) {
$BROWSER_PLATFORM='Unix';
} else {
$BROWSER_PLATFORM='Other';
}
'

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

I often get the answers from the search results alone, without even clicking on the links... Wink Of course I have Google quick search in my browsers, too, so it's only ever one click away. I find it faster and easier to look it up than to work it out.

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.