I have an iframe that loads on my page via ajax. At each interval, the new iframe overwrites the old. For some reason, the contents of the iframe remain in my memory in IE7. I am sure that this is the contents of the iframe, because when I load a small site in an iframe, the size of the memory increases slowly. When I load a large site into the frame, it speeds up with each update.
I would like to clear the contents of the iframe from memory every time an interval is called. I tried the scripts below (this one for windows.onunload - I also tried this every interval), but both of them do not work and keep the iframe contents in my memory until I end the browser session.
// Remove iframecontents window.onunload = function() { $('iframe').each(function(i, frame) { frameDoc = frame.contentDocument || frame.contentWindow.document; frameDoc.removeChild(frameDoc.documentElement); }); } // Remove iframe with jQuery window.onunload = function() { $('iframe').each(function(i, frame) { $(frame).remove(); }); }
If there is a way to remove content from an iframe from my memory without restarting the browser?
These solutions do not seem to work either: iframe control and memory in javascript jQuery DOMWindow script does not free memory
source share