Home  >  Article  >  Web Front-end  >  What is the difference between iframe and frame? Summary of the differences between iframe and frame

What is the difference between iframe and frame? Summary of the differences between iframe and frame

云罗郡主
云罗郡主Original
2019-01-04 10:01:1412767browse

This article brings you what is the difference between iframe and frame? The summary of the difference between iframe and frame has certain reference value. Friends in need can refer to it. I hope it will be helpful to you. [Recommended reading: Html5 tutorial]

What is the difference between iframe and frame? Summary of the differences between iframe and frame

What are the shortcomings of iframe?

iframe will block the Onload event of the main page

The search engine's search program cannot interpret this kind of page, which is not conducive to SEO

iframe and the main page share the connection pool , and the browser has restrictions on connections of the same domain, so it will affect the parallel loading of the page

You need to consider these two shortcomings before using iframe. If you need to use an iframe, it is best to dynamically add the src attribute value to the iframe through javascript, which can avoid the above two problems

The difference between iframe and frame

frame It cannot be used alone without frameSet, iframe can;

frame cannot be placed in the body;

The following code can be displayed normally

<!--<body>-->
<frameset rows="50%,*">
<frame   name="frame"   src="test.html"/>
</frameset>
<!--<body>-->

The following code cannot be displayed normally

<body>
<frameset rows="50%,*">
<frame  name="frame"   src="test.html"/>
</frameset>
<body>

The iframe nested in the frameSet must be placed in the body;

<body>
<frameset>
<iframe   name="frame"   src="test.html"/>
</frameset>
</body>

The following cannot be displayed normally:

<!--<body>-->
<frameset>
<iframe   name="frame1"   src="test.html"/>
</frameset>
<!--</body>-->

Iframes that are not nested in the frameSet can be used freely;

<body>
<iframe   name="frame"   src="test.html"/>
</body>
<!--<body>-->
<iframe   name="frame"   src="test.html"/> s
<!--</body>-->

The height of the frame can only be controlled through frameSet; iframe can be controlled by itself, not through frameSet

If more than two iframes are used on the same page, they can be displayed normally in IE. Only the first one can be displayed in Firefox; using two or more frames will work fine in both IE and Firefox.


The above is the detailed content of What is the difference between iframe and frame? Summary of the differences between iframe and frame. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn