Drupal 8 and the slow death of IE8
IE8 is resisting to die. Internet Explorer 8 world-wide usage is more popular than IE9 and even IE10
First, a small story.Once upon a time, in 2012, when Drupal 8 was going to support IE8, we added HTML5Shiv to Drupal core to support HTML5 elements in IE8 and old browsers. But during 2013 things happened. jQuery decided to split their library into:
- jQuery 1.x (IE8, IE7, IE6 support)
- jQuery 2.x (IE9 support and newer)
Both branches have the same jQuery API. This situation, clearly pushed the Drupal core maintainers into a big decision: Should Drupal 8 core ship with jQuery 1.x or 2.x ?. Nat Catchpole ("catch") summarized this dilemma very well: And the community and Dries, decided almost at the same time to embrace ECMAScript 5, jQuery 2 and drop IE8 support. The change record was modified (to include IE8 as not supported). And we all rejoiced, specially front-end developers. Yay! To end this small story, I will link it to the beginning: there is a task pending about removing HTML5Shiv from Drupal core. All the IE8 issues are spread in drupal.org, so it's nice that nod_ created a meta issue: Drop IE8 support.Present. 2014Looking back, it looks like dropping IE8 support was a good decision. This allowed core developers to write more efficient CSS3 and ECMAScript 5 code. And we avoid to waste the valuable time of core developers supporting old browsers. We jumped on the bandwagon of modern JavaScript libraries. As I said sometimes, the biggest change in Drupal core front-end is not Twig, it's Drupal core dropping IE8 support. The only big problem is that IE8 is dying very slowly. During the discussions in 2012-2013 we thought that IE8 usage will drop fast (we wanted to believe that). But the reality hurts, This is a chart from StatCounter (IE8 has a 4.71% usage. IE11 is not available in the chart, but it has a 6.29% usage in March 2014): From netmarketshare.com, the trend is even worse. IE8 has still 21.14% of the browser share on March 2014. I hid other browsers in the charts to highlight the situation with Internet Explorer.But one thing is clear: IE8 seems to be more popular than IE9, IE10 and even IE11. This is mainly due of Windows XP users. Why the difference between StatCounter and Netmarketshare?They have different methodologies. As I understand, netmarketshare manipulates their data to make them more realistic.They are adding a country level weighting, based on how many internet-users the country has, even if their data samples are tiny. So that could distort a bit their data. But the good thing in netmarketshare methodology, is that they count users not traffic. (the same user is only counted once per day, no matter how many page loads she makes). In the other hand StatCounter counts page visits, not users. For example, for StatCounter, an internet-savy teenager loading hundreds of pages per day in Chrome, counts the same as 100 hundred "grandpas" that are loading once a day their local newspaper in IE8. There is no winner. Both charts are correct, since they represent different things. But the truth is that there is a lot of people outside there using IE8 today. The hopeEveryone hopes that IE8 dies faster, including Microsoft. Two positive notes:
- Tomorrow, 8th of April, Microsoft is announcing the drop of Windows XP support. No more updates.
- IE8 doesn't exist in mobile phones. The trend is that mobile browsers are eating desktop browsers usage, around the world.
Non official FAQ. Drupal & IE8What if you try to load a Drupal 8 website with IE8? IE8 won't support many CSS3 stuff and EcmaScript 5 code. So a broken layout and lost JavaScript funcionality will be the normal thing to see. Drupal will load jQuery 2.x (that uses addEventListener method), IE8 will complain about it, stop parsing jQuery, and all your jQuery code won't work because "SCRIPT5009: jQuery is undefined". What if a customer asks for IE8 support?Stick to Drupal 7. The other option is to use a Drupal 8 and the work-in-progress-contrib-module IE8 Drupal module, that should downgrade jQuery to 1.x branch and include lots of polyfills to support ECMAScript 5 in IE8. Personally, it sounds to me too "magical", that it could fix all CSS and broken JS, specially if your site has many contrib modules. But for sure, it will help. Also notice that Drupal helps the situation a bit, including "X-UA-Compatible" http header to force IE use the most recent IE engine. What if I'm maintainer of Drupal module or theme? Drupal's core decision is pushing "gently" all the contrib modules and themes to follow the same path. When porting your modules, JavaScript code, etc make sure it works well with jQuery 2.x API. If you’re upgrading your Drupal 7 jQuery code from a version older than 1.9, jQuery team recommends to read the jQuery 1.9 Upgrade Guide since there have been a lot of changes, and help yourself using the jQuery Migrate plugin. Once that is migrated to 1.9, it will be compatible with jQuery 2.x, because they should have same API. Corrections welcomePlease, comment in this article, correct me in case I did wrong assumptions and I will update the post with the most up-to-date information.