<iframe width="100%" height="427" frameborder="0" style="border:0" src="https://www.google.com/maps/embed/v1/place?q=place_id:[place_id]&key=[my_key]" allowfullscreen></iframe>
"Google Maps Platform 拒绝了您的请求。此 IP、站点或移动应用程序无权使用此 API 密钥。从 IP 地址 xxx.xxx.xxx.xxx 收到请求,引用者:https ://xxx.xxx/ "
在 Google Dev 中,我启用了 Maps Embed API 和 Maps Static API。我已将密钥限制为仅与我的域一起使用,其中包含上述代码,例如https://[asterisk].thedomain.com/[asterisk]。
当我不将密钥限制在这个单一域时,地图嵌入工作并且不会引发错误。
问题是,密钥在代码中是可读的,因此我需要将密钥限制在我的域中。
有任何想法吗?
谢谢你。