“您已在此页面上多次添加Google Maps API”错误 [英] "You have included the Google Maps API multiple times on this page" Error

查看:88
本文介绍了“您已在此页面上多次添加Google Maps API”错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的html页面中有以下内容:

I have the following in my html page:

    <script type="text/javascript"
            src="http://maps.googleapis.com/maps/api/js?libraries=geometry&sensor=false">
    </script>
    <script 
        async defer
        src="https://maps.googleapis.com/maps/api/js?key=hUnDAdjYG_Wz7u2qL6unHqfBOmvaZ0H1Mg&callback=initMap">
    </script>

第一个链接用于Google的API Geometry Library,第二个链接用于初始化并绘制地图。

First link is for Google's API Geometry Library , and the second initialises and draws the map.

我收到错误消息您已在此页面上多次添加Google Maps API。这可能会导致意外错误。

I'm getting the error "You have included the Google Maps API multiple times on this page. This may cause unexpected errors."

我知道这可以通过调用一个脚本并更改参数来修复,参见 Fixing"您已在此页面上多次添加Google Maps API。这可能会导致意外错误。我不知道如何为我的问题复制答案。

I know that this can be fixed by calling just one script, and changing the parameters, see Fixing "You have included the Google Maps API multiple times on this page. This may cause unexpected errors." I don't know how to replicate the answer for my problem though.

推荐答案

您可以包含一个链接:

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

基本上合并两个链接中的url参数。

Basically merging the url parameters in both the links.

这篇关于“您已在此页面上多次添加Google Maps API”错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆