Browser caching is one of the easiest to implement website speed performance optimization tasks. And while it may have little impact on the initial load time of your web page, it can make subsequent page views significantly faster.
To find out if your website is set up with browser caching enabled, you can use the following tool.
Does your website have Browser Caching enabled?
Find out whether your site needs to enable browser caching, and if so, how much of an impact it can make on your PageSpeed score.
However, if the website is set up with browser caching enabled, the visitors web browser will store a copy of those resources in cache — a temporary holding space for files that are not likely to change for a specified period of time. These stored files are referred to as “cache”, “browsing data”, or “temporary internet files” by different web browsers.
By telling the web browser to “hold on” and “re-use” these resource files, subsequent views of your web pages by the same visitor can be much faster, as the majority of resources will already be available on the visitor’s computer or device.
Setting up your website to inform the visitors web browser to use browser caching is fairly easy if you’re running a the Apache web server (which is the typical setup for Linux hosting platforms).
If you do not already have a file named .htaccess within the root folder of your website, create one.
Once you have a .htaccess file, add the following code to it:
You can change the cache duration in the above code for each of the file types if you feel that you want the visitors web browser to retain the resources for a longer period of time, however.
The code above is surrounded by a set of tags (<IfModule mod_expires.c> and </IfModule) which instruct the Apache web server to only attempt to set the included instructions if the “mod_expires” Apache module is installed. Mod_expires, which allows for browser caching, is available by default in most Apache installations.
Ensure you’ve uploaded your .htaccess file up to the root folder of your website.
To check if your website has browser caching enabled, re-run the test at the top of the page.
So how do you resolve those third party files that do not have browser caching enabled? Well, many of them do not have caching enabled for a very good reason, such as the resource itself may be dynamically generated (rather than being a static file) that serves time-sensitive data. You can see this in weather widgets and embedded maps.
But if you’re willing to try, you can try loading those resources in your web browser, saving a copy of them to your local PC. Then, transfer those resources to your website, and then in your web pages, change the reference to those resources to those that you just saved in to your website.
Automating Browser Caching
Browser caching, of local and offsite resources, is just one of the features that is automatically enabled in the Pegasaas Accelerator automated WordPress speed optimization plugin.