Changing the position of iframe In the dom in non-ie6, ie7, and ie8 will cause the orientation of iframe to be reloaded.

Source: Internet
Author: User

Today, when the position of the iframe element in the dom tree changes:

1) In ie9, chrome, safari, and firefox browsers, changing the position of iframe In the dom will cause the orientation of iframe to be reloaded, and all resources will be requested here, and trigger the onload of iframe itself.

2) but other labels with the src attribute such as img will not cause a new request.

3) Some status labels such as checkBox and select change the position in the dom tree, and the changed status will still be maintained.

(4) However, in ie6, ie7, and ie8, the iframe reload will not occur.

 

Isn't reload the reason for the past, so ie9 follows other browsers?

I personally think it is better not to reload it. There is no reason.

The following is the test code:

  

<! Doctype html> <BODY> <div id = "div1" style = "width: 500px; height: 500px; background-color: green; left: 100px; top: 100px; "> <div id =" div11 "style =" width: 300px; height: 300px; background-color: yellow "> </div> <iframe id = 'ifr' src =" http://www.baidu.com "onload =" alert ('Load once ') "> </iframe> <! --  --> <select id =" oSelect "NAME =" Cars "SIZE =" 3 "MULTIPLE> <option value =" 1 "SELECTED> BMW <option value =" 2 "> Porsche <option value =" 3 "SELECTED> Mercedes-Benz </SELECT> <input style = 'float: right 'Type = 'button 'value = 'change the position in the dom 'onclick =' changeDom () '/> </div> <script type = "text/javascript"> function changeDom () {// document. getElementById ('div1 '). insertBefore (document. getElementById ('ifr'), document. getElementById ('did11'); document. getElementById ('v11 '). appendChild (document. getElementById ('ifr'); document. getElementById ('v11 '). appendChild (document. getElementById ('opselect') ;}</script> </BODY> </HTML>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.