Uses efficient cache policies on static assets
Requesting your users to save and recycle files from your site can help speed up page load times.
When a user visits a page on your website, their browser must download all the files -- images, text, code, javascript files, etc. -- associated with that page in order to display it correctly and efficiently.
Some web pages with a lot of assets can take up a lot of memory, forcing it to load slowly. The strength of the user’s internet connection and the device they are using can be impacted by these files, especially when there are many of them and how large the file(s) are. The larger the files, the slower the load time. The greater the amount of files increases the amount of requests in the server.
How does browser caching help?
When a user visits your site, their web browser can store files locally so that the next time they visit that page, locally stored files will render quicker and thus there is less data being requested by the browser.
Things like headers, footers, logos and other static items that do not change on certain pages or are reusable across different pages on your site can be stored this way and allow performance to speed up as the user explores the site, and even better, when they return to use.
When you first landed at DomainSpy.info, many of the things you see and code lying underneath are static. The items pointed out here are just a few examples.
If a user's browser downloads the logo in your header and stores it locally once a month -- a cached file -- then they would not need to download it again for a month and every page they visit on your site will load quicker over the next month.
Making it work
Leveraging browser caching can begin with setting an expires on the common assets in your http header files.
- Using an FTP client, edit the htaccess file in the root folder of your domain to execute this.
- Setting the expiry time between one month to a year should do the trick, but be wary of a lengthy time if your going to be making large changes to your site regularly or consider editing the file if your site goes through a revamp.
- If you set the cache for too long, frequent users may not see design changes because they are loading old assets