Details after setting the iframe's src to about:blank

Details after setting the iframe's src to about:blank
After setting the iframe's src to 'about:blank', the memory will not be released if it is not set to "about:blank". You must also use iframe.document.write('');
This is the only way to clear the content, but after this processing there will still be about 500-1000K of memory remaining. This is the iframe bug of IE6. Dynamically created iframes will always consume some memory.

Copy code
The code is as follows:

function clearIframe(id){
var el = document.getElementById(id),
iframe = el.contentWindow;
if(el){
el.src = 'about:blank';
try{
iframe.document.write('');
iframe.document.clear();
}catch(e){};
//The above can clear most of the memory and document node records.
//Finally, delete this iframe.
document.body.removeChild(el);
} } clearIframe('iframe_id');

<<:  Detailed explanation of the implementation of nginx process lock

>>:  Navicat for MySQL tutorial

Recommend

Node.js returns different data according to different request paths.

Table of contents 1. Learn to return different da...

Analysis of the principle and usage of MySQL continuous aggregation

This article uses examples to illustrate the prin...

JavaScript canvas to achieve mirror image effect

This article shares the specific code for JavaScr...

Summary of the use of html meta tags (recommended)

Meta tag function The META tag is a key tag in th...

Detailed explanation of JSONObject usage

JSONObject is just a data structure, which can be...

The whole process of IDEA integrating docker to deploy springboot project

Table of contents 1. IDEA downloads the docker pl...

SQL GROUP BY detailed explanation and simple example

The GROUP BY statement is used in conjunction wit...

How to add and delete unique indexes for fields in MySQL

1. Add PRIMARY KEY (primary key index) mysql>A...

A brief discussion on whether MySQL can have a function similar to Oracle's nvl

Use ifnull instead of isnull isnull is used to de...

In-depth explanation of Session and Cookie in Tomcat

Preface HTTP is a stateless communication protoco...

How to run a project with docker

1. Enter the directory where your project war is ...