Iframe Refuses to Display

Iframe Refuses to Display

I am trying to load a simple iframe into one of my web pages but it is not displaying. I am getting this error in Chrome:

Refused to display ' in a frame because an ancestor violates the following Content Security Policy directive: "frame-ancestors 'self' ".


Invalid 'X-Frame-Options' header encountered when loading ' 'ALLOW-FROM  is not a recognized directive. The header will be ignored.

This is the code for my iframe:

<p><iframe src="" width="680" height="500" frameborder="0"></iframe></p>

I am not really sure what that means. I have loaded plenty iframes before and never received such errors.

Any ideas?

5 Answers

It means that the http server at cw.na1.hgncloud.com send some http headers to tell web browsers like Chrome to allow iframe loading of that page () only from a page hosted on the same domain (cw.na1.hgncloud.com) :

Content-Security-Policy: frame-ancestors 'self' 
X-Frame-Options: ALLOW-FROM 

You should read that :

2

The reason for the error is that the host server for has provided some HTTP headers to protect the document. One of which is that the frame ancestors must be from the same domain as the original content. It seems you are attempting to put the iframe at a domain location that is not the same as the content of the iframe - thus violating the Content Security Policy that the host has set.

Check out this link on Content Security Policy for more details.

For any of you calling back to the same server for your IFRAME, pass this simple header inside the IFRAME page:

Content-Security-Policy: frame-ancestors 'self'

Or, add this to your web server's CSP configuration.

The same issue appears to me, just don't open the page in a private window.

In my case it was that the site i was embedding had a specific url for embedding content and a different url for sharing

the url i had set in the iframe was


changing it to


worked for me

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Elena Rostova
Author

Elena Rostova

Elena Rostova holds a Master's degree in Public Health Journalism. She covers groundbreaking medical research, holistic wellness trends, mental health awareness, and nutritional science.