The browser
The performance of your website in a user’s browser depends on a variety of factors: The size and make-up of your HTML, the number of external resources and their loading order, how many CSS files are loaded, how they are parsed, and the number and loading order of external JavaScripts. Images and JavaScript are the most significant contributors to the page weight for most of the Top 1000 sites examined by this study in 2018.
It is typically a significant task to reduce the amount of JavaScript used on a site and, where possible, to implement a CSS-only approach. There are other steps, for example reducing the size of images, that you can implement quickly. Adding a service to use an API, such as tinify, to minimize the file sizes of images on your pages is an easy task for your developers. Where possible, change the image tags in your HTML to formats like WebP (a CDN might also do this for you out of the box). And while you’re at it, consider rendering multiple versions of your images in the dimensions used for each breakpoint.
At b13, we try to solve front-end challenges without the use of JavaScript first. If possible, we use CSS to add features such as an accordion, a tab container or a slider element type to a front-end template without sacrificing ease of use or design requirements. If there is a need for JavaScript, we choose Vanilla JavaScript before going to frameworks. While jQuery is easy to use for developers, it can impact performance.
One example of making loading times as efficient as possible is handling the lazy-loading of images. Loading images only if and when they become visible in the viewport area of the user’s browser will speed up loading times of your webpages. There are a number of different implementations using jQuery or other frameworks that promise to be a plug-and-play solution to the lazy-loading of images. This is certainly handy and easy to use, but it requires that you add a library of code you don’t need. A small block of JavaScript (around 500 bytes) can accomplish the same thing without using additional resources or introducing dependencies that could affect your project.
There are other tasks to consider when optimizing the front-end performance of your website: Reduce the number of custom fonts, use SVGs instead of Icon fonts, inline critical or page-specific CSS to reduce your sites “main” CSS file size. Check out our solutions and best-practices to help optimize your pages.