[英]Google Chrome refused to display GoogleMaps Frame because X-Frame-Options is set to deny
I'm working on a website for a shop and I'm using the GooleMaps Engine Lite to show his location. 我正在一个商店的网站上工作,我正在使用GooleMaps Engine Lite来显示他的位置。 It works on IE9 and 10, Safari for Windows, iOS and MacOs and Mozilla Firefox, but it's not working on Chrome.
它适用于IE9和10,Safari适用于Windows,iOS和MacO以及Mozilla Firefox,但它不适用于Chrome。 If I use the Javascript Console I can see the following error:
如果我使用Javascript控制台,我可以看到以下错误:
Refused to display 'https://accounts.google.com/ServiceLogin?service=mapsengine&passive=1209600…up=https://mapsengine.google.com/map/embed?mid%3DzehbkDaSW5QM.kyKZHGifzxMc' in a frame because it set 'X-Frame-Options' to 'DENY'.
Could anybody help me? 有人能帮助我吗?
First time I had the problem it disappeared when I rebooted my computer, but today the problem appeared again. 我第一次遇到问题,当我重新启动计算机时它就消失了,但今天又出现了问题。 I've read on Google forums that the conflict comes when you are semi-logged with your Google account.
我在Google论坛上看到,当您使用自己的Google帐户进行半登录时,就会发生冲突。 If I log out completely my account or log in the map re-starts to work.
如果我完全注销我的帐户或登录地图重新开始工作。 In Safari you will find the same issue.
在Safari中,您会发现同样的问题。
A temporary solution is sandbox the map iframe to forbid it to access the cookies. 临时解决方案是将地图iframe沙箱禁止访问Cookie。
https://developer.mozilla.org/en-US/docs/HTTP/X-Frame-Options https://developer.mozilla.org/en-US/docs/HTTP/X-Frame-Options
The X-Frame-Options HTTP response header can be used to indicate whether or not a browser should be allowed to render a page in a
<frame>
or<iframe>
.X-Frame-Options HTTP响应头可用于指示是否应允许浏览器在
<frame>
或<iframe>
呈现页面。 Sites can use this to avoid clickjacking attacks, by ensuring that their content is not embedded into other sites.站点可以通过确保其内容未嵌入到其他站点中来避免点击劫持攻击。
The counter-question I have to you is why are you implementing that URL in an iframe, when it specifically tells the browser it does not want to be loaded in an iframe? 我对你提出的反问题是,为什么你在iframe中实现该URL,当它明确告诉浏览器它不想在iframe中加载时?
Did you follow the instructions at https://support.google.com/mapsenginelite/answer/3024935?hl=en when embedding the map? 在嵌入地图时,您是否按照https://support.google.com/mapsenginelite/answer/3024935?hl=zh-CN上的说明进行操作?
You're linking to the Google Account login page for the maps generator, not to a map. 您要链接到地图生成器的Google帐户登录页面,而不是地图。 The link is probably not what you want.
链接可能不是你想要的。
To make an embeddable map from Google Maps Engine, 要从Google Maps Engine制作可嵌入的地图,
1)在左下角点击6个齿轮,“共享和整合地图”2)在打开的对话框中按“整合地图”3)你得到了具有正确src的iframe线。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.