Loading multiple maps libraries with javascript

后端 未结 2 1644
醉酒成梦
醉酒成梦 2020-12-17 08:59

I am trying to load both the maps library and the places library with javascript so I can embed a map into my page, use google.maps.geometry.spherical functions and make pla

相关标签:
2条回答
  • 2020-12-17 09:29

    The first script doesn't point to a javascript, this will try to load the maps-homepage as a script(of course this will fail).

    There is no need to include multiple scripts, simply use:

    <script type="text/javascript"
      src="http://maps.googleapis.com/maps/api/js?libraries=geometry,places&sensor=false">
    

    This will load the maps-API(V3) and includes the places+geometry-libraries

    https://developers.google.com/maps/documentation/javascript/libraries?hl=en

    However, as Colin said, this looks like V2-code.

    0 讨论(0)
  • 2020-12-17 09:48

    You can use it in this way

    <script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=YOUR_KEY&libraries=places"></script>
    
    0 讨论(0)
提交回复
热议问题