google static map api works on host only after loc

2019-06-14 11:47发布

问题:

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

回答1:

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

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