None of the current answers work with 100% consistency for me (excluding Google Loader, which I have not tried). I donβt think that checking the existence of google.maps enough to make sure that the library has finished loading. Here are the network requests that I see when the Maps API and the additional "Places" library are requested:

This very first script defines google.maps , but the code that you probably need ( google.maps.Map , google.maps.places ) will not be found until some other scripts load.
It is much safer to define a callback when loading the Maps API. @Verti's answer is almost correct, but still relies on google.maps unsafely validation.
Instead, do the following:
HTML:
<script async defer src="https://maps.googleapis.com/maps/api/js?key=API_KEY&callback=mapsCallback"> </script>
JS:
var isMapsApiLoaded = false; window.mapsCallback = function () { isMapsApiLoaded = true;
Don McCurdy Aug 20 '15 at 18:23 2015-08-20 18:23
source share