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>