Too much info
naughtyboy
Status: New User - Welcome
Joined: 07 Jun 2004
Posts: 1
Reply Quote
I want to use the Browser and OS detection script to manage my css but I want the script to tell me if the OS is Windows or Mac I dont need the breakdown of which windos OS.

I think I should be able to just comment out some lines but it is excaping me.

Could someone please help?

Thanks,

Naughtyboy
Back to top
good question
jeffd
Status: Assistant
Joined: 04 Oct 2003
Posts: 594
Reply Quote
It's very easy to do that.

On the script, scroll down to line 268 (assuming you haven't cut off the comments on top:

Make this change:

:: Code ::

// get os data, mac os x test requires browser/version information, this is a change from older scripts
      $a_os_data = which_os( $browser_user_agent, $browser_name, $version_number );
      $os = $a_os_data[0];// os name, abbreviated
//add these lines
      if ( ( $os == 'win' ) || ( $os == 'nt' ) )
      {
         $os = 'win';
      }
// and you'll get what you need to happen
$os_number = $a_os_data[1];// os number or version if available


Now you have the $os variable containing only the following:

win, mac, lin, unix, or '', unknown.

You can ignore the $os version number if you don't need to use it.

Here's a sample of this:
:: Code ::

if ( browser_detection( 'os' ) == 'win' )
{
load css file one....
}
elseif (browser_detection('os') == 'mac' )
{
load css file 2
}
else
{
load default css file
}


does this answer your question? if not, just post again, give a code sample if something is not working for you, thanks, Jeftd
Back to top
Display posts from previous:   

All times are GMT - 8 Hours