If it is not set to about: blank, the memory will not be released. Also use iframe.doc ument. write (); in this way, the content can be cleared. This article will discuss in detail the details after setting src of iframe to about: blank, if you are interested, do not miss out on setting the src of iframe to 'about: blank '. If you do not set it to 'about: blank', the memory will not be released. You must also use iframe.doc ument. write ('');
In this way, the content can be cleared, but after such processing, there will still be around-kb of memory residue. This is the iframe bug of ie6, And the dynamically created iframe will always consume some memory.
The Code is as follows:
Function clearIframe (id ){
Var el = document. getElementById (id ),
Iframe = el. contentWindow;
If (el ){
El. src = 'about: blank ';
Try {
Iframe.doc ument. write ('');
Iframe.doc ument. clear ();
} Catch (e ){};
// You can clear most of the memory and document node records.
// Delete the iframe.
Document. body. removeChild (el );
} ClearIframe ('iframe _ id ');