Impossible "as is."
When you request a script from Google, they send the headers by script, and these headers contain the no-cache directive.
So, if you want them to be cachable, you have to create a proxy. Instead of pointing the script src to Google, you point it to your server. Then your server makes a call to Google and sends a response to the client.
This way you will control the HTTP header and caching. You can also cache the contents of the script to make fewer connections to Google.
I would not advise anyone to do this in production or on a critical website. All Google APIs are updated frequently and linked more or less together. If something does not sync with something else, itβs hard for you to track the error on your hands.
Hope this helps.
EDIT: I heard that you posted your scripts in the HEAD section of your document. Perhaps this harms your "perceived" page load time. Try moving the script loading just before the </body> and initializing the map in the onload page.
Mike
Mike gleason jr couturier
source share