谷歌地图 API 问题.不使用 API 密钥使用 [英] Google Map API Issue. Using without API key

查看:39
本文介绍了谷歌地图 API 问题.不使用 API 密钥使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当 Google 突然提示任何访问者 Google 的 MAP 已在我们网站中停用,因为它没有正确的域引用或因为密钥错误时,我们的 Google MAP 实施工作正常;相同的密钥在我们用于开发目的的一个子域中工作正常,因此我们非常确定问题不依赖于我们的目的.我们还仔细检查了 Google 开发人员控制台上的设置,一切都已设置正确.

"Our Google's MAP implementation was working fine when suddenly an alert was being prompt by Google informing to any visitor that Google's MAP was deactivated in our site because it didn't have the correct domain references or because the key was wrong; the same key was working fine in one of our sub-domains, which we use for development purposes, so we were pretty sure that the issue didn't rely on our end. We also double checked the settings on Google's developers console and everything is setup properly.

最后我们暂时从 API 调用中移除了密钥,直到找到解决方案;不包含密钥的后果是什么?您可以给我们什么建议来解决这个问题?

At the end we removed the key from the API call temporarily until we find a solution; what are the consequences of not including the key and what recommendations could you give us to solve this issue?

我们也在使用 Google 的 Page Speed 技术.

We are also using Google's Page Speed technology.

推荐答案

我尝试过的一件事是确保 Google Developers Console 中显示的 Referer 模式足够通用,例如*.mysite.com/* 而不是 mysite.com

One thing I tried was to make sure that the Referer patterns shown in the Google Developers Console were sufficiently generalised, e.g. *.mysite.com/* rather than mysite.com

这显然有帮助,但进一步的测试与几乎总是在 Windows Safari (5.1.7) 和 Firefox (29.0.1) 上显示的警报不一致.相比之下,它很少在 iOS 上的 Safari 上显示.

This apparently helped but further testing was inconsistent with the alert shown almost always on Windows Safari (5.1.7) and Firefox (29.0.1). In contrast, it was rarely shown on Safari on iOS.

由于我的 Web 应用程序不太可能每月发出 20000 个请求,因此我决定放弃密钥并使用<script src="http://maps.googleapis.com/maps/api/js?sensor=false"></script>

As my web app is unlikely to make 20000 requests a month, I decided to ditch the key and use <script src="http://maps.googleapis.com/maps/api/js?sensor=false"></script>

到目前为止,这没有任何明显问题.

So far, this has worked without any apparent issues.

这篇关于谷歌地图 API 问题.不使用 API 密钥使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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