从 img 标签加载时,Google 静态地图 API 禁止 403 [英] Google static map API getting 403 forbidden when loading from img tag
问题描述
我有一张谷歌地图,它显示了一个房产的位置,但是当我来打印动态地图时,它的打印效果不太好,所以我决定实现谷歌静态地图图像 API.
^^ 是打印视图中的属性示例,应该显示静态地图图像,但无法加载并查看我的检查器,我收到图像的 403 Forbiden 响应.
但是如果我直接访问 URL,图像会加载...
我做错了什么?
谢谢
斯科特
糟糕,我觉得自己像个白痴.我使用的是旧的 V2 地图 API URL 而不是新的 V3 API URL.我收到了 403,因为我在使用 V2 URL 时没有提供 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.
^^ 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.
But if I go to the URL directly the image loads...
What am I doing wrong?
Thanks
Scott
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 :(
这篇关于从 img 标签加载时,Google 静态地图 API 禁止 403的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!