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
EDIT:
If you are not afraid to be "not explicit" then you can use following, otherwise if you are not sure if there will be only one instance of google variable then use DaveS answer.
Check if google maps v3 api loaded:
if(google && google.maps){
console.log('Google maps loaded');
}
in this condition variable google will use javascript truth so if it will be function or object or string it will become true and then will try to access maps inside of that object.
And inverse:
if(!google || !google.maps){
console.log('Not loaded yet');
}