谷歌静态地图API得到403从IMG标记加载时禁止 [英] Google static map API getting 403 forbidden when loading from img tag
问题描述
我已经是一个谷歌地图,显示了酒店的位置,但是当我来打印动态地图打印不那么好,所以我决定执行谷歌静态地图图像API。
What I have is a Google map that shows the location of a property but when I come to print the dynamic maps dont print so good so I decided to implement the Google Static Map image API.
<一个href=\"http://lpoc.co.uk/properties-for-sale/property/oldgate-dairy-st-james-road-long-sutton-cambridgeshire-pe12/?prop-print=1\" rel=\"nofollow\">http://lpoc.co.uk/properties-for-sale/property/oldgate-dairy-st-james-road-long-sutton-cambridgeshire-pe12/?prop-print=1
^^在打印预览属性的例子,应该表现出一个静态地图图像,但它无法加载,看着我检查我得到的图像403禁伐响应。
^^ is an example of a property in print view and should show a static map image but it fails to load and looking at my inspector I'm getting a 403 Forbiden response for the image.
但是,如果我去的URL直接加载图像...
But if I go to the URL directly the image loads...
我在做什么错了?
感谢
斯科特
推荐答案
哎呀我觉得像这样一个白痴。我用的是旧V2地图API网址,而不是新V3 API URL。我得到一个403,因为我用的是V2 URL无需提供API密钥:(
Oops I feel like such an idiot. I was using the old V2 maps API URL and not the new V3 API URL. I was getting a 403 because I was using the V2 URL without providing an API key :(
这篇关于谷歌静态地图API得到403从IMG标记加载时禁止的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!