JavaScript Caching Test
What is it?
Checks if your page is using caching headers for all JavaScript resources. Users browsers will check for these headers and, if any, will cache the JavaScript resources until the specified date (so that it does not keep re-fetching the unchanged file from your server). This speeds up your site the next time returning visitors arrive at your site and require the same JavaScript resource.
Pass rate:
-
Top 100 websites: 96%This value indicates the percent of top 100 most visited websites in the US that pass this test (in the past 12 months).
-
All websites: 78%This value indicates the percent of all websites analyzed in SEO Site Checkup (500,000+) in the past 12 months.
| 2021 | 98% |
|---|---|
| 2022 | 96% |
| 2023 | 95% |
| 2024 | 96% |
100
75
50
25
0
How do I fix it?
In order to reduce the number of HTTP requests, you can use the HTTP Expires header to set an expiration time for your JavaScript resources or any other content type.
You can add the following lines into your .htaccess file:
<IfModule mod_expires.c>
ExpiresActive on
ExpiresByType text/javascript "access plus 1 month"
ExpiresByType application/javascript "access plus 1 month"
</IfModule>