Search code examples
javascriptgoogle-apihttp-caching

Leveraging maps.googleapis browser caching, as per Google PageSpeed Insights advice


The following script:

<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=<my-key>&libraries=places"></script>

Results in a warning when the page is scanned from Google PageSpeed Insights:

Consider Fixing:

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:

https://maps.googleapis.com/…&libraries=places

(30 minutes)

How can I leverage the browser caching from 30 minutes to something higher?


Solution

  • Launch it as php with CURL from your server