[英]Loading google maps api with libraries
I'm trying to load both the main api and a library (Places) into my web application. 我正在尝试将主api和库(Places)加载到我的Web应用程序中。 According to the documentation, I'm supposed to load the Places library with: 根据文档,我应该加载Places库:
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?libraries=places&sensor=false"></script>
But when I use this in combination with my script tag to load the main api, it gives me an error that I'm loading the api twice. 但是当我结合我的脚本标签使用它加载主api时,它给了我一个错误,我正在加载api两次。 How could I load both in the same script tag? 我怎么能在同一个脚本标签中加载?
Since you've specified the places
in the libraries
param, you only need that one script. 由于您已在libraries
param中指定了places
,因此只需要一个脚本。 According to the docs : 根据文件 :
The JavaScript code for the Maps API is loaded via a bootstrap URL of the
form http://maps.googleapis.com/maps/api/js.
This bootstrap request loads all of the main Javascript objects and symbols
for use in the Maps API. Some Maps API features are also available in
self-contained libraries which are not loaded unless you specifically
request them.
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.