Jump to content

Caching for Google Maps?

Recommended Posts

I'm working on the speed of my own site and one thing 'Page Speed Insights' keeps telling me is to use caching for GMaps but I've already set up caching for JS in the htaccess file 

<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access plus 1 year"
ExpiresByType image/jpeg "access plus 1 year"
ExpiresByType image/gif "access plus 1 year"
ExpiresByType image/png "access plus 1 year"
ExpiresByType image/svg "access plus 1 year"
ExpiresByType image/svg+xml "access plus 1 year"
ExpiresByType text/css "access plus 1 month"
ExpiresByType font/truetype "access plus 1 month"
 ExpiresByType font/opentype "access plus 1 month"
ExpiresByType application/pdf "access plus 1 year"
ExpiresByType text/x-javascript "access plus 1 month"
ExpiresByType text/javascript "access plus 1 month"
ExpiresByType image/x-icon "access plus 1 year"
ExpiresDefault "access plus 7 days"

It seems (see below) that Page Speed wants me to set up a separate rule for the GMaps code but I don't know how



Leverage browser caching

Setting an expiry date or a maximum age in the HTTP headers for static resources instructs the browser to load previously downloaded resources from local disk rather than over the network.

Leverage browser caching for the following cacheable resources:



Share this post

Link to post
Share on other sites

As far as I'm aware, you won't be able to cache third-party scripts like this, because the files don't live on your server. Generally I recommend taking PageSpeed Insights with a pinch of salt, it simply looks for a set of rules and detects whether they pass or not. Most of the time the service will even complain about things out of your control like version numbers on files, even if they are Google's own product set by them.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing

    No registered users viewing this page.

  • Member Statistics

    • Total Members
    • Most Online

    Newest Member
  • Forum Statistics

    • Total Topics
    • Total Posts