Christian Heilmann

The myth of the “modern browser”

Friday, August 3rd, 2012 at 5:12 am

When I wrote my JavaScript book in 2005 one of the things my editor called out was that using the term “modern browsers” needs definition. I think it is time to go further and call it a myth.

An article of mine coming out soon just came back from the editor. One thing I mention in the article is that a very simple JavaScript test around your code can make sure that you don’t give any of your JavaScript to Internet Explorer older than version 9:

if (document.addEventListener) {
   document.addEventListener('DOMContentLoaded', function(ev) {
   	// your code
   }, false);  
}

My exact wording was:

Come to think of it, one simple addEventListener() on DOMContentLoaded is a great way of making sure your script is not executed in browsers that would choke on what you are trying to achieve. Maybe it is time not to pester IE6, 7 and 8 with a lot of code – they deserve to have a quiet time considering their age.

As you may guess, the rest of the article is a deep-dive into events in the browser. Now, I was asked by the editor to remove this part. Instead I was asked to add a disclaimer:

At the top, these sentences should be removed. They do not add anything to the article, and are a little hard to read. [...] Instead, it might be better to just put a short disclaimer saying “The examples in this article will only work on modern browsers like …”

My beef with this is “modern browsers” which can become immensely outdated very quickly – especially in a world of “evergreen” browsers or others being released every few weeks. The “modern browsers” of today could be an embarassment of a very near future.

The web is full of outdated tutorials and bad advice and the largest part of those happened because a snapshot of browser functionality at that time was considered state of the art and “modern browser” stuff. Instead of using the feature as the test for the code writers explained that you need a certain browser version. This is limiting and confusing.

I think it is time we stopped thinking in browser versions and instead check for availability of features. The browser market moves at a breakneck speed. In a discussion with friends the other day at Google we all agreed that in a not far away future all browsers should update in a silent fashion. End users should always have the newest browser without having to work on it and thus get new features when they are ready and hotfixes and security fixes in the fastest way possible. End users do not care about feature support, they just benefit once it is available and wrapped in a sensible UX.

For us developers it means we can free ourselves from the endless discussion of “what version of browser x are we saying we’ll support”. Sure, not all browsers will upgrade in a silent fashion. Our job, however, is to build solutions that are independent of browser and future facing rather than stick with a concept of quality assurance that is simply outdated and holds us back. If a feature is not available, let’s not use it. Try to surf with IE6 for a day and see how much fun it is. Then think how OK it would be to surf these sites without getting a lot of JavaScript that fails or gets loaded without executing. What is the better experience?

A “modern browser” is a moving target, you can not define it and you can not tell people to get one as they have no idea what that is. Let’s stop using the term and stop writing tutorials that are doomed to be old-fashioned by the time they get released.

Share on Mastodon (needs instance)

Share on Twitter

My other work: