在 Rails 4.2.4 中,我尝试通过 iframe 添加谷歌地图功能,但收到类似错误
Refused to display 'https://maps.googleapis.com/maps/api/js?key=AIsfsdfsdjLr31nsdsdfsdf16LORmV4d89hhg&output=embed' in a frame because it set 'X-Frame-Options' to 'SAMEORIGIN'.
查看文件是,
<iframe width="600" height="450" frameborder="0" style="border:0"
src="https://maps.googleapis.com/maps/api/js?key=AIsfsdfsdjLr31nsdsdfsdf16LORmV4d89hhg&output=embed" allowfullscreen>
</iframe>
如何解决这个 iframe 问题?
最佳答案
您将 JavaScript 文件作为 iframe
包含在内,而不是 Google map 的实际嵌入版本。您的 src
值应类似于 https://www.google.com/maps/embed/v1/place?q=Harrods,Brompton%20Rd,%20UK
。 Here's指向 Google map 嵌入 API 的链接。
关于javascript - Google map - 未通过 <iframe> 加载,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33732022/