Some more reasons to hate Internet Explorer 8 (and lower)

Recently, I’ve had to work inhumane hours. Not because I’m moonlighting 2 jobs, nor because of the stereotypical software development scene in India, which you constant hear about,  where  outsourcing firms treat their developers as slaves. This menace is what happens when some guys at Microsoft think it’s Cool not to follow CSS standards, like other webkit browsers. When they decide to go the extra-mile and incorporate security measures which’ll ultimately lead people to visit google.com/chrome.

Working on intranet websites in an organization which ships Windows 7 PCs packed with IE8, by default to it’s employees, is in itself a death sentence. If you have common sense more than that of a cat featured on /r/aww, you’d have moved on to a browser made for humans, rather than chimps.

I’m not going to highlight EVERYTHING that’s wrong with Internet Explorer 8, because let’s face it, I don’t have a truly unlimited web hosting plan. So here are a few I wasted my last few days on, something I wouldn’t wish on my mortal enemies…

I. Console.log

IE8 compatibility mode has no concept of a debugger’s life-line, aka the JavaScript’s console.log() method. Some late night Googling revealed you have to make your peace with the alert(“foo”) function. No seriously, time to show them visitors what’s happening in the background.

II. Intranet website and Compatibility Mode

Everyone uses this line in the section of their page:

<meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1" />

This ensures Internet Explorer would automatically use the latest rendering engine to display the website. Must be some sacred reason not to make it something which is done by default. Anyways, it gets better! That line is rendered USELESS if IE thinks you’re browsing an intranet website. In such cases, you have change a setting explicitly in every visitors browser, telling it not to render intranet website in compatibility mode. Cool, right?

III. Date().toISOString()

This useful method from Date class returns a string in simplified extended ISO format (ISO 8601), which is always 24 characters long: YYYY-MM-DDTHH:mm:ss.sssZ. The timezone is always zero UTC offset, as denoted by the suffix “Z”. Multiple date/time libraries out there use toISOString() method to handle time formats. This sadly, is not available in Internet Explorer 8 and below (surprise surprise!). In order to use it you’ll have to prototype Date as explained on MDN.

if (!Date.prototype.toISOString) {
  (function() {

    function pad(number) {
      if (number < 10) {
        return '0' + number;
      }
      return number;
    }

    Date.prototype.toISOString = function() {
      return this.getUTCFullYear() +
        '-' + pad(this.getUTCMonth() + 1) +
        '-' + pad(this.getUTCDate()) +
        'T' + pad(this.getUTCHours()) +
        ':' + pad(this.getUTCMinutes()) +
        ':' + pad(this.getUTCSeconds()) +
        '.' + (this.getUTCMilliseconds() / 1000).toFixed(3).slice(2, 5) +
        'Z';
    };

  }());
}