Iframe-based IE6 memory leak?

I am loading content using an iframe via a menu with a jquery update the 'src' iframe attribute to load to the desired page. Each page has its own javascript and heavy content.

The code is as follows: -

$(document).ready(function() {
    loadPage('main.php');
});

function loadPage(url) {
    $('#applicationFrame').attr('src', url);
}

And the iframe on the index page is as follows: -

<iframe id="applicationFrame" application="yes" trusted="yes" frameborder="0" />

(Side note: I understand that the iframe here accepts non-standard attributes, but it is an internal intranet application running on one of these Microsoft HTAs in which they mean something.)

In any case, the menu items simply call javascript: loadPage ('whatever.php') to load any content.

, , , , . sIEve : -

http://img37.imageshack.us/img37/3997/leaks.png

(21 → 44 → 65) ..

:

http://img527.imageshack.us/img527/4430/inspector.png

, iframed.

, ? - ? dojo , , . , , .

() IE6, .

+3
1

jQuery less. , SIEve.

function pos(obj) {
    var curleft = 0;
    var curtop = 0;
    if (obj.offsetParent) {
        do {
            curleft += obj.offsetLeft;
            curtop += obj.offsetTop;
        } while (obj = obj.offsetParent);
    }
    obj = null;
    return {left:curleft, top:curtop};
}

function loadPage(url) {
    var y = document.getElementById('container');
    var x = document.getElementById('applicationFrame');
    var p = pos(y);
    if (x.src) {
        var tmp = y.cloneNode(false);
        var tmpIF = x.cloneNode(false);
        tmpIF.src = url;
        tmp.appendChild(tmpIF);
        tmp.style.position = 'absolute';
        tmp.style.visibility = 'hidden';
        tmp.style["z-index"] = 20;
        tmp.style.top = p.top;
        tmp.style.left = p.left;
        y.id = "delete";
        x.id = "deleteApplicationFrame";
        document.getElementsByTagName("body")[0].appendChild(tmp);
        tmpIF = null; tmp = null;
    }
    setTimeout("document.getElementById('applicationFrame').style.visibility = 'visible'; var i = document.getElementById('deleteApplicationFrame'); i = i.contentDocument || i.contentWindow.document; i.documentElement.parentNode.removeChild(i.documentElement); i=null; i=document.getElementById('delete'); i.parentNode.removeChild(i); i=null;", 500);
    y = null; x = null; p = null;
}

<div id="container">
    <iframe id="applicationFrame" application="yes" trusted="yes" frameborder="0" src="main.php"/>
</div>

, , . IE6 - b..ch .

Internet Explorer

Internet Explorer -


, AFAIK, src HTML DOM W3C ( ?)?

src="main.php" iframe loadPage('main.php'); iframe.

<a>, <a href="notmain.php" target="nameOfYourIFrame">FooBar</a> javascript

+2

Source: https://habr.com/ru/post/1725034/


All Articles