<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>
Run Code Online (Sandbox Code Playgroud)
"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].
当我不限制此单个域的密钥时,地图嵌入工作并且不会抛出错误.
问题是,密钥在代码中是可读的,因此我需要将密钥限制在我的域中.
有任何想法吗?
谢谢.