Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iframe contents cant appear in Firefox

Below is my code:

<div style="border: solid 1px #000000; margin: 5px;">
  <iframe src="http://www.w3schools.com" width="100%" height="300px" scrolling="yes"><p>Your browser does not support iframe.</p></iframe>     
</div>   

Contents of iframe works well in chrome but not in firefox. I've disabled add-ons but my iframe is still empty. Can anyone please help me?

like image 326
bsm Avatar asked Aug 22 '13 06:08

bsm


2 Answers

If you are trying to add this Iframe on a SSL-encrypted website (https://), it won't work any more since Firefox 23 because Mozilla has decided to blocked all unencrypted content on encrypted websites (for example http-iframes on https-websites). You can change this behaviour in your own Firefox installation by typing about:config in the address bar and setting security.mixed_content.block_active_content to false. But that won't help you for all other FF23-visitors on your website.

like image 108
Keyser Soze Avatar answered Sep 19 '22 13:09

Keyser Soze


As of 05/2018, the iframe lead is denied by browser due to X-Frame-Options header set to 'sameorigin'.

Tested the page with Firefox and getting blank iframe. Here is what console says:

Load denied by X-Frame-Options: https://www.w3schools.com/ does not permit cross-origin framing.

Why that?I'll give Chrome console a chance, here's what it says:

Refused to display 'https://www.w3schools.com/' in a frame because it set 'X-Frame-Options' to 'sameorigin'.

Basically, X-Frame-Options header (do not confuse that with CORS), is set to 'sameorigin', that means that the browser is allowed to display the iframe content only if embedded in same domain and same protocol (https://www.w3schools.com/ is not sameorigin of http://www.w3schools.com/).

Here are some docs aboiut x-frame-options: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Frame-Options

like image 38
Giacomo Penuti Avatar answered Sep 20 '22 13:09

Giacomo Penuti