Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

multiple iFrames not showing in FF, Chrome and Safari

Tags:

iframe

I know using iFrame is strongly discouraged but I need to make the application that runs on IE8 and older and they already have large old codes using iFrames. I was stuck in a problem about the iFrames. Here is my two iframes:

<div>
 <div width="20%" height="100%">
  <iframe width="20%" name="treestruct" src="menu.html" height="800px"/>
 </div>
 <div  width="70%" height="100%">
  <iframe width="80%" name="mainbody" src="content.html" height="800px"/>
 </div>
</div>

Recently, I have been asked to make it work for Firefox too. But when I tried to see it on FF, the only first iFrame is shown. It works fine in IE but not in FF or any other modern browsers. I really got stuck what's going on here. What will be the solution for this? I know this might be a minor problem and I am also a great supporter of HTML5 and want to avoid these types of deprecated tags, but I have large code written in old html and have to make them work on IE8 and older. I do not have options. Any suggestions?

like image 910
jeewan Avatar asked Dec 23 '12 23:12

jeewan


People also ask

Does Safari support iframes?

sandbox attribute for iframes is Fully Supported on Safari 7.1, which means that any user who'd be accessing your page through Safari 7.1 can see it perfectly.

Why is iframe not working in Chrome?

If the page is https, you cannot load a iframe on that page that is not https. It will result in a "mixed-content error" and for security purposes it will not load. It works in FF because FF is more lax about this security restriction and Chrome happens to be more strict on mixed-content errors.

Do iframes work on all browsers?

The iframe element is supported by all modern desktop and mobile browsers.

How do I put two iframes side by side in HTML?

1. Remove width="100%" from the iframes. 2. Change align="right" to align="left" on the second iframe if you want them completely side-by-side.


1 Answers

According to w3school, you have to close your iframe tag with </iframe>. So change your code to something like this:

<div>
 <div width="20%" height="100%">
  <iframe width="20%" name="treestruct" src="menu.html" height="800px"></iframe>
 </div>
 <div  width="70%" height="100%">
  <iframe width="80%" name="mainbody" src="content.html" height="800px"></iframe>
 </div>
</div>

and give it a try. It should work just fine...

like image 88
EhsanT Avatar answered Oct 04 '22 07:10

EhsanT