I often get the answers from the search results alone, without even clicking on the links... 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.
Suzanne posted this at 22:17 — 12th April 2004.
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.
TonyMontana posted this at 05:27 — 13th April 2004.
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 posted this at 07:22 — 13th April 2004.
She has: 5,507 posts
Joined: Feb 2000
I often get the answers from the search results alone, without even clicking on the links... 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.