Dynamically Loading Google Maps api's

前端 未结 4 551
慢半拍i
慢半拍i 2021-01-05 04:00

Im trying to load the google maps api\'s dynamically. I\'m using the following code:

var head= document.getElementsByTagName(\'head\')[0];
var script= docume         


        
4条回答
  •  死守一世寂寞
    2021-01-05 04:23

    Make sure that you aren't instantiating the map before the Javascript has finished loading.

    Also, If you want to use the AJAX API loader, you need to do it like this:

    
    
    

    Otherwise, just use the regular Maps API script source:

    
    

提交回复
热议问题