A solution to the problem of suspended animation in IE caused by using multiple IFRAME in one page

Source: Internet
Author: User
Tags ticket

In my web front-end development encountered this situation, is that there is a need for a page into multiple iframe, click tab to jump different iframe, through the hidden and display of the IFRAME to achieve, and later found in Google and other browsers can be, But in IE will produce the state of suspended animation, there is only one page display normal, the other pages are blank, and later on the internet a lot of questions about the death of IE, there is said that jquery caused, there is also said to be IE memory overflow caused, When several iframe pages are loaded at the same time, IE does not know exactly when the page loading is complete, so there will be suspended animation status.

This is the way I used to define the global variable corresponding to the IFRAME, when the first click on the corresponding tab, the corresponding IFrame loaded, and then the corresponding variable increment, do judge if it is the first click on the load IFRAME, not the first click Do not do the operation, Simulates the effects of multiple IFRAME

function SetUrl (iframe, url) {
var el = document.getElementById (iframe),
iframe = El.contentwindow;
if (EL) {
EL.SRC = ' About:blank ';
try {
Iframe.document.write (");
Iframe.document.clear ();
} catch (e) {};
The above can erase most of the memory and the number of document node records
}
el.src = URL;
}

var h = 0; IE will cause the page to feign animation when using an IFRAME, so you need to click the number of times to simulate the effect of the IFRAME
var j = 0;
var k = 0;
Jump different pages according to different parameters
function Changetab (typenum) {
var iframe = "Showiframe" + typenum;
var url = window.websiterooturl;
var data = {
Ticket: $.page.ticket,
BasEntId:fw.fwCookie.FWCookieHelper ("Basentid"),
Entid: $.page.params.entid,
Hisentid: $.page.params.hisentid
};
var params = Fw.fwUrl.FWUrlHelper.param (data);
for (var i = 1; i < 6; i++) {
if (Typenum = = i) {
$ ("#showIframe" + Typenum). Show ();
SetUrl (' showiframe ' + typenum,);
} else {
$ ("#showIframe" + i). Hide ();
};
};
Switch (typenum) {
Case ' 2 ':
URL + = ' web/ent/insertent/entproduct.htm? ' + params;
if (h = = 0) {
SetUrl (iframe, URL);
};
h++;
Break
Case ' 3 ':
URL + = ' web/ent/insertent/entguardinfo.htm? ' + params;
if (j = = 0) {
SetUrl (iframe, URL);
};
j + +;
Break
Case ' 4 ':
URL + = ' web/ent/insertent/entemergency.htm? ' + params;
if (k = = 0) {
SetUrl (iframe, URL);
};
k++;
Break
};
};

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.