How to check if Google Maps API (v3) is loaded?
I do not want to execute mapping scripts if the API did not load due to internet connectivity problems (web page is h
If you are using jQuery, I have good news for you:
jQuery
if (typeof google === 'object' && typeof google.maps === 'object') { gmapInit(); } else { $.getScript('https://maps.googleapis.com/maps/api/js?key='+gApiKey+'&language=en', function(){ gmapInit(); }); }
it's similar to answer-17702802