After setting src of iframe to about: blank, we will discuss in detail _ HTML/Xhtml _ webpage Creation

Source: Internet
Author: User
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 ');

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.