简体   繁体   中英

Leverage Browser Caching and Console Warning

I made site and now when I'm tesitng this inside google PageSpeedInsights tool I have problem with Leverage Browser Caching for that same script.

This is my script that I'm calling inside HTML file

<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyDktC0AXgcEZ5p9yN3RKLs_HCi6JKjZUeE&callback=initMap"></script

PageSpeedInsights show me this problem

https://maps.googleapis.com/…Z5p9yN3RKLs_HCi6JKjZUeE&callback=initMap (30 minuta)

Also when I watching errors in the console show me te warning for that same script. Now I'm thinking that i make something totally wrong.

This is error in console:

Uncaught InvalidValueError: initMap is not a function js?key=AIzaSyDktC0AXgcEZ5p9yN3RKLs_HCi6JKjZUeE&callback=initMap:95

Does anybody now what is the problem.

Thanks

A similar issue was raised on this github project , in which they referenced a stackoverflow entry as a possible solution.

Make sure the initMap() is a global scoped function or the parameter passed to the Google Maps JS is properly namespaced.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM