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

查看:25
本文介绍了修复“您在此页面上多次包含 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天全站免登陆