Home > Treat IE6 users the right way with jQuery

Treat IE6 users the right way with jQuery

August 06, 2009Mike1 comments
IE6 users have probably noticed the effect of the following JavaScript placed at the top of each page:

$(document).ready(function(){
   if ($.browser.msie && $.browser.version.substring(0,1) <= 6) {
      ie6cat = $("<mt:Asset id="680"><mt:AssetLink encode_js="1"/></mt:Asset>")
      .attr("rel", "prettyPhoto");
      ie6cat.appendTo($("#alpha-inner"));
      $("a[rel^='prettyPhoto']").prettyPhoto({showTitle: true});
      ie6cat.click();
      ie6cat.remove();
   } else {
      $("a[rel^='prettyPhoto']").prettyPhoto({showTitle: true});
   }
});
For those with reasonably modern, standards-compliant browsers, it looks like this.
  1. August 08, 2009 at 17:28 | #1

    hello, this is a very friendly ie6 warning! :)

    supporting the quirks of ieN is imho a matter of doing a correct stylesheet, then override it selectively with a conditional comment stuff ( or so, forgot the details). it's still a pita, though.