解决“您已在此页面上多次包含Google Maps API.这可能会导致意外错误. [英] Fixing "You have included the Google Maps API multiple times on this page. This may cause unexpected errors."

查看:144
本文介绍了解决“您已在此页面上多次包含Google Maps API.这可能会导致意外错误.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在标头中包含以下两个脚本,并且收到错误消息您在此页面上多次包含了Google Maps API.这可能会导致意外错误."

I've included two below scripts in my header and I get the error "You have included the Google Maps API multiple times on this page. This may cause unexpected errors."

<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js key=************"></script>

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

当我删除任何一个脚本时,都会收到其他js错误.如何在Rails应用程序中正确重构这两个脚本?

When I remove either script, I get additional js errors. How can I properly refactor these two scripts in my rails app?

推荐答案

在上面的示例中,您两次包含相同的脚本,但是具有不同的参数.您只需包含一次脚本,并使用所有必需的参数,就可以解决您的问题,

In your example above, you're including the same script twice, but with different parameters. You should be able to solve your issue by including the script once, with all the required parameters like this:

<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=YOUR_KEY_HERE&libraries=places&sensor=false"></script>    

这篇关于解决“您已在此页面上多次包含Google Maps API.这可能会导致意外错误.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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