A Guest Post By Ben Shepardson
Website bloat is a growing problem and very often, Javascript is the driving force behind it all. Here’s why that’s happening, followed by two easy solutions for web developers who care about good UX.
In a world where UX is king, it’s curious to note that slow-loading websites are still a growing problem. Sadly, our benchmarks for what’s acceptable increase every year as we inch ever upwards towards larger and heavier sites.
Yesterday’s bloated monster of a slow-loading behemoth at 1 megabyte becomes today’s sleek and light example of what to aim for. Back in the day, 100 KB was considered too big. Today’s Tweets are heavier than yesteryear’s web pages.
JavaScript: Part of the Web’s Weight Problem?
Of course, we have Moore’s Law to thank for ever-increasing web capabilities. Modern hardware and internet infrastructure can handle an entire galaxy’s worth of extra data transfer. But, like ever-expanding suburbs and the highways that connect them, extra capacity soon gets filled up as we expand in every direction.
Needless to say, any developer caught ignoring the principles of UX and unleashing megaton websites on the browsing public should take a serious look inwards. It’s simply bad form.
Website bloat is such a huge problem, end users have taken matters into their own hands.
There are now layman’s tools for helping solve bloat on your own website, even when your web developer has sold you a heavy behemoth. Anyone can lighten up their own load by using code minifiers and image-handling techniques.
But this isn’t about tidying up your white space or decreasing pixels in your image carousel. This is about unwanted (read: unnecessary) javascript functionalities that are crashing websites, left and right.
Crashing websites is like crashing parties, it ends up ruining it for everyone.
That includes developers who use JavaScript efficiently, who may sometimes be unfairly blamed for bloating up the internet with their fancy code.
JavaScript is not to blame: unnecessary and therefore unwanted functionalities are the real culprit here.
Javascript is a Cornerstone of the Internet
No matter who you are – user or developer – you probably love JavaScript. It makes the Web what we need it to be today: fulfilling and dynamic, personalized and fun.
Nobody wants to go back to the days when all we had to work with was HTML.
Without dynamicity, that world would appear sad and flat to today’s users. And marketers? They’d be completely lost without being able to serve up those highly-targeted ads we’ve all come to expect when we browse the web.
We couldn’t even eradicate JavaScript from the Web if we wanted to.
It is now a fundamental building block of the web. Almost every browser supports it, and almost every website uses it. Increasingly, mobile and app development are forever entwined with JavaScript as well.
Plus, we have derivatives like the jQuery library and Node.js (which takes JavaScript to the server side). Both are further evidence that JavaScript is here to stay.
JavaScript is, however, responsible for some of the weight gain of today’s websites.
It’s not JavaScript itself to blame for the extra weight, but rather the way it’s being used.
In short, many of the functionalities of JavaScript can be handled in different ways, thereby lightening the load across the board for all kinds of websites.
Two Key Solutions for JavaScript-Based Bloat
So, what’s a developer to do? Here are some ideas of how JavaScript can be used in better ways to trim the fat so to speak. These don’t cover all of the creative ways you might tackle this issue, but they will point you in the right direction.
1. Wean ourselves from jQuery addiction
jQuery is a wonderful, time-saving convenience, but it’s overused. Using it for simple tasks is often not necessary with today’s browsers. These kinds of tasks have surprisingly robust native implementations that perform jQuery-style functionalities all by themselves. Stick to native JavaScript whenever possible.
2. Limit surveillance scripts
Third-party tracking code is responsible for much of the weight gain of the internet. We all know it to be true, yet web developers are still held hostage to clients who insist on loading up their seemingly wonderfully optimized and fast-loading newly designed site with cookies, tracking code. Online marketing companies don’t always realize the weight that elaborate advertising code can cause. If you’re not using it, let it go.
Learn 10 Ways To Create A Great User Experience For Your Website Visitors
The moral of the story is that JavaScript is great when used properly. What’s more, it’s here to stay, so we may as well learn to get along with it.
Ben Shepardson is the founder of NoStop Blog Content, a boutique writing agency focusing on helping small business clients take their websites to the next level.