google静态地图api只能在localhost后在主机上运行 [英] google static map api works on host only after localhost

查看:113
本文介绍了google静态地图api只能在localhost后在主机上运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我为我的网站设置了简单的API访问密钥..我设置了Referers:www.mysite.com和www.mysite.com/* ..

i am using static map api in我的网站.ex: https://maps.google.com/staticmap?markers=11.6879216,92.7241781&size=300x300& 键=的myKey &安培;传感器=假。 。
当我尝试访问页面时,我收到了此消息..

Google Maps API服务器拒绝了您的请求,该网站或IP未授权使用此API密钥。

但是,如果使用wamserver在本地主机中使用相同的API密钥加载相同的页面,则会显示地图。 。
之后,它显示网站中的地图,如果我再次加载

为什么会发生这种情况?


任何人都可以解决我的问题。

提前致谢

i have Simple API Access key for my website..
I have set Referers:www.mysite.com and www.mysite.com/*..
i am using static map api in my website.ex: https://maps.google.com/staticmap?markers=11.6879216,92.7241781&size=300x300&key=mykey&sensor=false. .
when i am trying to access in page i got this message..
"The Google Maps API server rejected your request. This site or IP is not authorized to use this API key.".
But if load the same page with same api key in localhost using wamserver, it shows the map. .
After that it shows the map in website also if i load again.
why is it happening like this?.
can anyone solve my problem.
thanks in advance

推荐答案

只要确认您正在输入网址添加到IMG元素的src标记中?

Just confirm that you are putting the URL into the src tag of an IMG element?

确保您已在API控制台页面上为您的个人密钥启用了静态API: https://code.google.com/apis/console/

Make sure you have enabled the static API for your personal key on the API console page: https://code.google.com/apis/console/

这篇关于google静态地图api只能在localhost后在主机上运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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