Html iframes not working


I am learning how to do iframes. They don’t appear to working online. The frame is created, but the content does not load.

However, if I download the workspace and run from my machine, everything works correctly without me having to make any changes to the code.

Could someone please advise me as to what is wrong and how I can correct this.


Can you please post your code here, so that we can try to figure out why? Also, if you are running it inside the preview inside c9, please open it in a new tab and check, as the preview isn’t always reliable.


We have determined that the iframe coding works if the src is to an
internal page within my own site. However, if I change the src to an
external website such as, the iframe does not load

If we download the project, both internal and external pages work within
the iframe coding. So we assume the coding is right.

But here it is anyways:

not work:

<iframe src="" height="500" width="850">

does work:

<iframe src="hello-world.html" height="500" width="850">


This is likely due to the server you are using (Apache or the like) setting the X-Frame-Options header. This specifies what can be loaded into IFrames, and it’s likely set to SAMEORIGIN right now. Do a quick google search and you’ll find some great articles on what it does like this MDN one.