A Browser Sniffer/Screen Resolution Sniffer that swaps stylesheets

This is based on two javascripts, combined. This script contains a browser sniffer that will test for Mac or PC, and will also test if the PC is 800×600 or a higher resolution. I figure most macs are set to a decent resolution, but have found much to my dismay that many PC’s here are still set to 1997 standards.

This will swap style sheets depending on what is “sniffed”.

I’ve included the locations for the original scripts, which contain other options you may wish to include.


* Browser/resolution sniffer - CSS switcher script
* based partially on:
/**********************************************
* Different CSS depending on OS (mac/pc)- © Dynamic Drive 
* (www.dynamicdrive.com)
* This notice must stay intact for use
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/

/*
* and on:
* Screen Resolution Redirect
* © Eddie Traversa (nirvana.media3.net)
* To add more shock to your site, visit www.DHTML Shock.com

* Combined version of the script available from http://thedesignspace.net */

var mac_css='http://url.of.macstylesheet/stylesMac.css'  //put the url of your mac stylesheet here
var mactest=navigator.userAgent.indexOf("Mac")!=-1
var screen_height = screen.height;
var screen_width = screen.width;

if (screen_height >= 650) {  
var pc_css='http://url.of.pcstylesheet/stylesPC1024.css'; //put the url of your PC stylesheet for highrez screens here
document.write('')
} 

else {
var pc_externalcss='http://url.of.pcstylesheet/stylesPC800.css';  //put the url of your PC stylesheet for 800 x 600 rez screens here

document.write('')
}