Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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. It works on IE9 and 10, Safari for Windows, iOS and MacOs and Mozilla Firefox, but it's not working on Chrome. If I use the Javascript Console I can see the following error:

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?

like image 376
Donnie Rock Avatar asked Dec 20 '13 11:12

Donnie Rock


People also ask

How do I change X-Frame-options in Chrome?

Enabling X-Frame-Options headerOpen up the Network panel in Chrome DevTools and if your site is using a security header it will show up on the Headers tab. Another quick way to check your security headers is to quickly scan your site with a free tool, securityheaders.io, created by Scott Helme.


2 Answers

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. If I log out completely my account or log in the map re-starts to work. In Safari you will find the same issue.

A temporary solution is sandbox the map iframe to forbid it to access the cookies.

like image 138
Donnie Rock Avatar answered Oct 01 '22 15:10

Donnie Rock


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>. 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?

Did you follow the instructions at https://support.google.com/mapsenginelite/answer/3024935?hl=en when embedding the map?

  • Make sure you have your desired map open and that it is set to be accessible by the Public.
  • Click the folder button.
  • Select Embed on my site.
  • In the box that appears, copy the HTML under 'Embed on the web,' and paste it into the source code of your website or blog.
like image 35
pzkpfw Avatar answered Oct 01 '22 15:10

pzkpfw