MegaZone (zonereyrie) wrote,

  • Mood:
  • Music:

KBlogger: Know Thine Enemy - Microsoft Internet Explorer - AND DEFEAT IT!

I'd be willing to bet that most of the people reading this are doing so in Internet Explorer. That's not very surprising, since, depending on who you listen to, 80-90% of web users use Internet Explorer. Most people are on Windows, and, hey, the big blue 'e' is right there on the desktop already. Just click it and surf, no problem.

Except there is a problem - IE is a giant, steaming pile of dung. Ignoring the fairly well publicized security issues with IE (even on WinXP with Security Pack 2 applied IE is the least secure of all browsers, by miles - on any older version of Windows, don't bother asking), IE has the worst standards support of all the major browsers. Firefox, Safari, Opera, Konqueror, Camino, and others, all run rings around IE.

Now, I admit I am biased. I started out in graphical browsers with NCSA Mosaic, then I switched to Netscape. I think I still have my install floppies for the copy of Netscape 1.22 Gold that I purchased. (Yes, purchased.) I used NS right up through version 4.79, and I clung to it long after it was, frankly, woefully out of date. I just never liked the interface on IE, and I had used NS for so long it was second nature. A big factor for me was that I use UNIX/Linux systems in addition to Windows, and using Netscape meant I could use the same browser on all my systems. IE on Linux? Right. (And anyone who ever used the IE port on Solaris wishes they hadn't.)

For a while I alternated between NS 4.79 and beta releases of Mozilla Suite. I made the switch to using Mozilla full-time when 1.0 was released. I used Mozilla Suite right up through 1.8b, and then I jumped to Mozilla Firefox. Mozilla, and Firefox, have the same advantage Netscape had - working on Windows, Linux, and MacOS, so you can have the same tool across platforms. Firefox is also just a superior browser in every way, as far as I'm concerned. More secure, better standards support, a plethora of fantastically useful extensions (which I'll talk about in a future entry - in the meantime check out this entry from TDavid's Blog.), tabbed browsing, pop-up blocking, fine controls over cookies - just a lot of nice features. Now, to be fair, Opera and Safari are also very nice browsers with many of the same features, standards support pretty much on par with Firefox, and some nice plusses of their own. I think any of the three are good choices, they all have plusses and minuses and a lot of it comes down to personal preference. (Safari is MacOS only, but Opera is also cross-platform like Firefox.) And WinXP SP2 added some features to IE6 as well.

OK, so it should be clear by now that I think everyone would be wiser to jump ship and run Firefox, or just about anything other than IE. (I wouldn't recommend Netscape anymore, frankly. It is based on Mozilla's tech, you may as well just get the real thing. NS 8.0, the latest, has some serious issues - avoid it.) The only reason I keep IE around is because I know surfers use it, so I better make sure my sites work in it too. (OK, and because Windows Update, and some other pieces of software, have been tied to IE exclusively. Not surprising of Microsoft to tie to their own browser, but shame on third party vendors who do the same.) While you may be able to make the switch (you know you want to), you still have to cope with users who insist on running around the net naked with an 'Infect Me' sign on their backs - in other words, using IE. (Let me take a moment to say I've met and spoken with some of the people who work on IE for MS, and they're nice, intelligent people. I just think they've been shafted by management.)

If you've ever tried to develop a standards compliant website that takes advantage of the current state of the art in XHTML, CSS, and ECMAScript/JavaScript, then you've probably know what it is like to beat your head against the brick wall that is Internet Explorer. Since it was released in 2001, IE6 hasn't seen any substantive updates. The world doesn't stand still, especially the online world, and standards have evolved since then. IE6 had fair standards support when it appeared, but it had, and still has, a number of bugs, plus huge gaps in what it actually supports. Broken support is worse than no support. With no support at least you could use something for other browsers, and allow it to degrade in IE. But when IE does the wrong thing, you can't even do that.

Web masters are faced with the choice of 'dumbing down' their sites to accommodate IE, creating multiple versions of the site - at least one for IE and one for decent browsers - and resorting to User Agent sniffing, or using all manner of hacks and work-arounds to try to coax IE into playing nice. The latter usually means giving up on the hope of being standards compliant - and that opens another can of worms in making sure the site still works in browsers that do understand the right way to do things. By the time you're done you can find yourself buried in tons of bailing wire, duct tape, and chewing gum - and it still won't work right.

There is an alternative - you can beat IE into submission and make it behave - for the most part. To do this you'll need a very big stick - fortunately someone has already hewn and polished the stick for you. That someone is Dean Edwards, and the stick is his 'IE7' JavaScript library. Yes, I know, MS has finally decided to start working on IE7, which will be available only for WinXP or newer platforms like Windows 2003 and Longhorn. This has nothing to do that that, Dean named it well before MS decided to make an IE7 and now that they are he is planning to rename his library. But for now, it remains IE7. Don't be confused, when I talk about IE7 below I mean his library. IE7 is currently up to version 0.8, and it can be downloaded here.

IE7 is basically a powerful JavaScript library that uses scripting to fix bugs in IE and add support for more standards by handling the functionality in JavaScript and/or mapping them onto other features in IE to get the desired result. It isn't perfect, nor foolproof, but it works in IE5 and up and it will do most of what any web master is going to be looking to do. It will save you countless hours of trial and error, and from the hell of messy hacks. You include the library in your pages using a trick in IE - conditional comments - so that the library only loads in IE, and not in other browsers. As an example, if you wanted the full base CSS1&2 support, and the CSS3 support he's added so far, you might put the following in your document:

<!--[if lt IE 7]>
<script src="/ie7/ie7-standard-p.js" type="text/javascript"></script>
<script src="/ie7/ie7-css3-selectors.js"

That's assuming you install the library in a directory called 'ie7' on your docroot, of course. And that's all you have to do! Just include the library, and any optional modules you need, and go about creating your site using the standards. Since this is cleverly exploiting a proprietary feature of IE other browsers will see that entire block as a comment, and hence they will not load the scripts. IE5 and up will evaluate the expression and if the version is less than 7 (as it is for all current IE releases), it will load the scripts. So this is a very clean fix that doesn't impact other browsers at all.

By simply using this library, you're able to use standard XHTML & CSS - and IE actually does the right thing. (Most of the time - it isn't 100% perfect, but it is damn good.) You can do dynamic menuing using just XHTML & CSS - no scripting needed. In non-IE browsers the menus work as is using the native rendering engine, in IE the library helps out. If you want to have a fixed navigation bar at the top of a page, or anywhere really, you can do that without resorting to frames. IE doesn't support CSS position: fixed; but with IE7 it does. I've used both of these features, and others, on the Cyphermint site.

This is one of the major time saving tools available to a webmaster trying to use standards - but it isn't nearly as well known as it should be. Dean has already spent the countless hours tracking down, developing, and compiling the patches that make IE behave like it would if MS cared about supporting standards. Don't waste time re-inventing the wheel. You no longer have the excuse of "It doesn't work in IE" for avoiding using modern web standards, and even less justification for developing anything that is 'IE only'. Every web master should have IE7 in their toolbox.

OK, on a completely different subject, I thought I'd share a little trick for people who want to syndicate or read specific KBlogger blogs. As you probably know if you've looked over in the right column at the 'Syndicate' information, this is the syndication feed for KBlogger in general. But say you only want to get a feed for one of the specific blogs? You can do that too! This is Digital Soapbox aka this blog, this is TDavid's Blog, and this is Raven's Blog. You can do that with any of the blogs. Look at the links on the right, and find the id (like 'C74') in the URL, then use that in the syndication URL. Simple!

Tags: geek, kblogger, software, standards, web
  • Post a new comment


    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded