How to check if Google Maps API is loaded?

前端 未结 10 2176
花落未央
花落未央 2020-12-04 16:12

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

10条回答
  •  情深已故
    2020-12-04 16:48

    I believe you can do this with an if(google && google.maps){ … }, unless you mean what is in this post, which is about Maps API V2, but someone updated it for v3 here.

提交回复
热议问题