549-ie10-conditional-comments

Microsoft added many features to Internet Explorer over the years. Several revolutionized the web forever (XMLHttpRequest, the DOM, XML tools, font embedding, browser add-ons). Some never caught on. Some were truly awful.

The team intends to remove several of the less-successful legacy features in IE10 (perhaps they read #7 in 10 Ways Microsoft Could Make Us Love IE Again?) I suspect you’ve never coded XML Data Islands and Element Behaviors, but you’ve almost certainly used Conditional Comments. They’re about to disappear from IE forever.

Conditional Comments 101

Ensuring you web site or application works in all browsers is tough. It’s made particularly difficult when you have to support older editions of Internet Explorer. IE6 was released in 2001, IE7 in 2006, and IE8 appeared in 2009. Whatever your opinion of Microsoft, it’s unreasonable to expect a 10 year old browser to render the same as Firefox 5 or Chrome 12.

Web developers are particularly scathing about IE6. Many months are spent building fantastic web sites and applications only to find they break in IE6 at the eleventh hour. Fortunately:

  • IE6 bugs are well-documented and it’s possible to overcome the majority of issues — especially if you test early and often.
  • Microsoft provide Conditional Comments so developers can add custom CSS and script fixes which target a specific version of IE.

Examine the source of almost any HTML5 page and you’ll find this code in the head:


<!--[if lt IE 9]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->

It loads a shim in IE8 and below which allows the developer to style new HTML5 elements such as header, article, and footer. It’s not required in IE9 and other browsers with native HTML5 support — they ignore the script.

Conditional Comments are incredibly useful but, personally, I always felt a little uncomfortable using them:

  1. They smell a little like browser sniffing — which stinks.
  2. They’re rarely necessary. The majority of IE6 problems can be solved with a display:inline; here or a position:relative; there. While competing browsers don’t require those properties, they don’t have a negative impact other than a few bytes of extra bandwidth. I prefer my CSS properties in one place rather than distributed between two or more files.
  3. Conditional Comments are abused. I’ve had the misfortune to work on systems where developers created three or four separate stylesheets which targeted individual browsers. Simple property updates required changes to every file.

Why Remove Conditional Comments?

IE8 is normally well-behaved and you’ll only require the HTML5 shim (see above). With a few CSS3 exceptions, IE9 renders as well as any other browser. Hopefully, IE10 will catch-up — or even overtake — Firefox, Chrome, Opera and Safari.

Conditional Comments are not required. There’s no need for “[if IE 10]“ because pages will render (mostly) the same in all modern browsers.

That said, it’s not the end of feature detection and progressive enhancement. Not every browser supports CSS3 transformations, web sockets, geo-location and client-side storage. Even with support, the user can often disable or refuse permission for an operation.

In addition, Conditional Comments will not disappear from IE6, 7, 8 and 9. You can still target those browsers should the need arise but it will become less necessary over time.

I applaud Microsoft’s decision. It’s a bold move since they could have easy kept Conditional Comments and I suspect its removal will horrify some developers. However, the company is adhering to its “same markup” philosophy and ensuring HTML, CSS and JavaScript just work regardless of the browser or version.

It’s the right thing to do. Let’s hope the demise of ActiveX, Compatibility View and the old IE7 toolbars won’t be too far behind!

WordPress Dashboard

As the Internet Explorer 6 Deathwatch continues, another web service — WordPress.com — has announced that it is ending support of the nearly decade-old web browser.

Citing “increasingly complex code trickery to make the WordPress dashboard work,” the company announced an end to IE6 support.

The dashboard will still load for IE6 users, it just won’t function very well. IE6 users will be alerted that their browser is outdated and given direct links to browser updates or to download an alternative browser via the Browse Happy website.

In addition to dropping IE6 support, WordPress.com has also rolled out some new features, including a revamped and redesigned dashboard and a new distraction-free writing mode.

These features — as well as the end-of-life for IE6 support — will make their way to self-hosted WordPress installs with WordPress 3.2. The beta version of WordPress 3.2 is available for download now and the final version is expected to land sometime in June.

WordPress.com, which hosts millions of websites, joins a long list of providers that have officially decided that enough is enough in regards to IE6. In March, Microsoft launched its own global campaign calling for the end of the browser.

More About: IE6, internet explorer, WordPress.com

For more Dev & Design coverage:

376-uk-ie6-petition

In February 2010, I reported that UK citizens could sign an online petition which demanded Internet Explorer 6 updates across all Government departments. The 6 June deadline has now passed and the Government has posted their response. You won’t be happy — they’re keeping IE6.

It’s a shame but we shouldn’t be surprised. The petition attracted just 6,223 signatures so it was hardly a mandate from the British people. That’s a reasonable number of web designers and developers but, since we’re the main beneficiaries, no one could say it was unbiased.

The petition’s biggest mistake was to cite security as the main concern:

IE6 has some security flaws that leave users vulnerable. These two governments (France and Germany) have let their populations know that an upgrade will keep them safer online. We should follow them.

The issue was too vague and could be accused of scaremongering. The Government’s response:

Complex software will always have vulnerabilities and motivated adversaries will always work to discover and take advantage of them. There is no evidence that upgrading away from the latest fully patched versions of Internet Explorer to other browsers will make users more secure. Regular software patching and updating will help defend against the latest threats. The Government continues to work with Microsoft and other internet browser suppliers to understand the security of the products used by HMG, including Internet Explorer and we welcome the work that Microsoft are continuing do on delivering security solutions which are deployed as quickly as possible to all Internet Explorer users.

Each Department is responsible for managing the risks to its IT systems based on Government Information Assurance policy and technical advice from CESG, the National Technical Authority for Information Assurance. Part of this advice is that regular software patching and updating will help defend against the latest threats. It is for individual departments to make the decision on how best to manage the risk based on this clear guidance.

IE6 has had more it’s fair share of vulnerabilities, but it’s also received a decade’s worth of security patches. In Europe, the browser’s market share has fallen below 3.5% so it’s no longer a high-priority target for hackers. Finally, Government departments have stringent security systems in place: it’s not easy for a user to become infected when they can’t access the outside web.

Perhaps the petition would have had a better chance during less challenging economic times. The final part of the Government response highlights the complexity and cost to the taxpayer:

It is not straightforward for HMG departments to upgrade IE versions on their systems. Upgrading these systems to IE8 can be a very large operation, taking weeks to test and roll out to all users. To test all the web applications currently used by HMG departments can take months at significant potential cost to the taxpayer. It is therefore more cost effective in many cases to continue to use IE6 and rely on other measures, such as firewalls and malware scanning software, to further protect public sector internet users.

The new UK Government has embarked on a massive cost-cutting exercise. Citizens are unlikely to be receptive toward millions spent on IT upgrades of negligible benefit when that cost can be directly compared against job losses, nurses salaries, education and defense budgets.

The problem for us is that 12 months is a long time in Internet years and browser upgrading is easy. Yet most Government IT projects have a minimum timescale of 5 to 10 years and the technologies they adopt are reliable (they’re already old). Even those departments undergoing an upgrade are only just moving to IE7. It’s frustrating but, even if they implemented Firefox 3.6 or Chrome 5 today, we’d be demanding further upgrades within a few months.

Ultimately, you have an easy choice. If you don’t want to develop for IE6, don’t undertake jobs where it’s a requirement.

Read the full UK Government IE6 petition response…