A Browser Sniffer/Screen Resolution Sniffer that swaps stylesheets
November 19, 2003
CSS | Javascript

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 800x600 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.


Ads by Google

Posted by ellen at November 19, 2003 04:05 PM

* 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('')
}


Ads by Google


Ads by Google

 RSS   |   Contact Me


Ads by Google