如何正确地包含带有参数的谷歌地图API

How to properly include Google Maps API with parameters?

本文关键字:谷歌地图 API 参数 正确地 包含带      更新时间:2023-09-26

我收到了警告You have included the Google Maps API multiple times on this page. This may cause unexpected errors.,我相信这是因为我的<head>:中有这两行

<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=MYAPIKEY"></script>
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?libraries=drawing"></script>

我尝试过各种方法将这些内容包含在一行中,如key=MYAPIKEY&libraries=drawing,但它要么无法导入,要么仅导入图形库。你知道如何正确导入这个吗?

尝试以key=MYAPIKEY&amp;libraries=drawing的身份加入,让我知道它是否有效

<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=MYAPIKEY&amp;libraries=drawing"></script>