Can we depend on JavaScript: predicting, and assuming a future

Back in the days when we created full flash sites, it was considered to be a best practice to create an HTML version of the site as a fallback, so people without flash could use it too. This practice was not used often, but the sites that did, still work today, on all current devices. Back when we created these sites, we thought the fallbacks would be used less and less in the future: everybody would have Flash in a few years time. This idea turned out to be false. We could not imagine a future where Flash would be gone.

Imagining the future is hard

We can not imagine a future where people will not have JavaScript turned on by default. But a future like this is definitely possible. The reason why flash is gone is because it wasn’t webby enough: it was created for screens of a certain size that were controlled by a mouse only. Everybody knows that this is not the web. JavaScript is pretty webby in that sense, so that would not be the reason why more and more people will stop using it, or why device vendors might even turn it off by default.

Security

JavaScript was always considered to be a pretty safe language, at least, I always thought it was without any risk. It turns out some pretty nasty stuff can be done with it, like retrieving passwords. Once people understand and realise this, they might become a bit more careful with using it. It could even be that a future device vendor might decide to turn it off by default. This would be crazy, but so is the American legal system. Companies don’t want to be sued.

Our future

To be clear, I do not hope this future will become our reality one day. I love the beautiful and handy stuff we can do with JavaScript. I just wrote this post as a reminder that on the web, we should not depend on JavaScript. Or any one single technology, for that matter. If we want to be sure that our sites still work in a few years time, we should use the classic web stack.

Comments

  1. There once was a time you couldn’t rely on browser support for CSS, PNG images, iframes etc. Those are now considered “standard” and no develop would even consider creating fallbacks for that.

    The same will be said about the new html5 API’s and their strong dependence on JavaScript.

    The biggest advantage of JavaScript over Flash is that no plugins are required. It might evolve and something better might arise in time, but browsers will continue to provide JavaScript support for a long time.

    • Vasilis
    • #

    Hi Dirk. Your comment is a little off topic — the article is not about creating fallbacks for JavaScript because some browsers might not support it, it’s about the idea that it’s hard to think of reasons why it could be turned off by default in the (near) future. But it’s an interesting comment nevertheless, and a comment I could disagree on:

    Until recently we definitely created fallbacks for PNG images since they were not fully supported by IE6. It’s true that we (probably) don’t do that anymore. On the other hand, we always create a fallback for CSS, since most of our sites should just work without any styling, and they will even be usable if we use proper markup. And I definitely know of implementations where a fallback scenario is created for certain recent APIs like GeoLocation and HTML5 Video.

    I completely agree with the advantage of JavaScript over Flash, and I think there are many more advantages. But then again, that was not the point of this post.