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

Detailed explanation of Linux index node inode

1. Introduction to inode To understand inode, we ...

Implementation of tomcat deployment project and integration with IDEA

Table of contents 3 ways to deploy projects with ...

hr horizontal line style example code

Copy code The code is as follows: <hr style=&q...

How to use docker to build redis master-slave

1. Build a Docker environment 1. Create a Dockerf...

Introduction to fuzzy query method using instr in mysql

Using the internal function instr in MySQL can re...

jQuery to achieve sliding stairs effect

This article shares the specific code of jQuery t...

Detailed explanation of how to monitor MySQL statements

Quick Reading Why do we need to monitor SQL state...

Linux cut command explained

The cut command in Linux and Unix is ​​used to cu...

CSS to achieve floating customer service effect

<div class="sideBar"> <div>...

Solve the problem that await does not work in forEach

1. Introduction A few days ago, I encountered a p...

Five ways to traverse objects in javascript Example code

Table of contents Prepare Five weapons for…in Obj...