Warning: gzinflate() [function.gzinflate]: data error in /home/boozkerc/public_html/kneedeepincode/wp-includes/http.php on line 1787

First off, I want to say that I take no credit for this idea. This script is heavily based on Jay Salvat script which can be viewed on his blog.
My jQuery script is similar, but has a minor fix for IE7, smaller size and includes built in debugging just by setting the debug var to true. This will alert you of the browser, engine, and the OS of your user. Not only can it be helpful to you, but also clients. I’ve had to deal with more than one client who didn’t know their browser or browser version.
It simply adds the browser, engine and the OS to the html tag. With no set up at all, you can start using it right after you put it in your jQuery document.ready function. Here is an example to target IE6:
.ie6 body {background:blue;}
This is much cleaner than the normal way of targeting IE6 which might look something like:
<!--[if lte IE 6]> <style type="text/css"> body {background:blue;} </style> <![endif]-->
So on with the actual code! Below is the code. simply copy and paste it into your document ready function.
$(function(){var debug = false; var ua=navigator.userAgent.toLowerCase();var myBrowsers={mozilla:$.browser.mozilla,safari:$.browser.safari,opera:$.browser.opera,ie:$.browser.msie,ie6:$.browser.msie&&($.browser.version<7),ie7:$.browser.msie&&($.browser.version==7),ie8:$.browser.msie&&($.browser.version>7),iphone:/iphone/.test(ua),chrome:/chrome/.test(ua),firefox:/firefox/.test(ua),webkit:/webkit/.test(ua),osx:/mac os x/.test(ua),win:/win/.test(ua),linux:/linux/.test(ua)};if(debug){i=1;}$.each(myBrowsers,function(a,b){if(b)$('html').addClass(a);if(b&&debug){if(i==1){x='Browser: '}else if(i==2){x='Browser Version: '}else{x='OS: '}alert(x+a);i++;}});});
You can also just link directly to it from Google here:
http://jquery-secretagent.googlecode.com/files/secretAgent.js
Please post all errors and add to the wiki here:
http://code.google.com/p/jquery-secretagent/
Here are the supported classes (all that apply will be added to the html tag):
- .mozilla
- .safari
- .opera
- .ie
- .ie6
- .ie7
- .ie8
- .iphone
- .chrome
- .firefox
- .webkit
- .osx
- .win
- .linux