Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Web Technology by (20.3k points)

I’m embedding Google Maps into my web site. Once Google Maps is loaded, I need to kick off a few JavaScript processes.

Is there a way to auto-detect when Google Maps has fully loaded, including tile downloads and all?

A tilesloaded() method exists that is supposed to accomplish exactly this task but it does not work.

1 Answer

0 votes
by (40.7k points)

If you are using if (google.maps) {...} and it gives you a reference error if google is undefined (i.e. if the API didn't load).

Then you can use this, if (typeof google === 'object' && typeof google.maps === 'object') {...} to check if it loaded successfully.

Browse Categories

...