Solution to the crash caused by ActiveX controls in extjs

Source: Internet
Author: User

Problem
In my current project, the front-end is fully built using extjs based on the "one-page" concept. Except for an HTML container, it is all JavaScript files (pages are implemented by JS files ). When a user switches to a page, we analyze a page object, create a new page object, and display it in HTML. Based on this architecture, we also introduced an ActiveX control for displaying reports. This problem arises: as long as you access a page with a report control and switch the page twice, ie will crash (FF does not have this problem.
Cause
Because the system design considers the release of resources, the analysis structure is specially processed, and the page without ActiveX does not have a problem. Therefore, the problem must be caused by the release of ActiveX controls contained in JS by IE. After all, in the traditional front-end built with HTML, JSP, and PHP pages, ActiveX is a page. As long as the user jumps, the page is unloaded, and ActiveX is destroyed; however, our system uses continuous re-drawing of an HTML page to achieve jump, that is, the system will never refresh, and there will be no unload. ActiveX will naturally not be destroyed, leading to Browser Crash.
Solution
If you know the reason, let's find a solution. Since ie cannot help us destroy ActiveX controls. Let's just do it ourselves: CopyCode The Code is as follows: // @ acitvexobjectid: the range of nodes to be queried. Find the ActiveX to be deleted from this node.
// @ Contianerid: ID of the ActiveX control to be deleted.
Function activexkiller (acitvexobjectid, contianerid ){
VaR Ce = Document. getelementbyid (contianerid );
If (CE ){
VaR CCE = Ce. Children;
For (VAR I = 0; I <CCE. length; I = I + 1 ){
If (CCE [I]. ID = acitvexobjectid ){
Ce. removechild (CCE [I]);
}
}
}
}

This method is used to remove ActiveX controls. The principle is also simple. Based on the given node range (generally the parent node and container of the ActiveX control), you can use the ID of the given ActiveX in the Dom to perform step-by-step search. Once found, you can manually remove it.
with this killer, we can solve ActiveX before page re-painting to avoid crash.
In addition, there is a special case. That is, when you place an ActiveX control in an Ext. Window. If you want Ext. Window to destroy ActiveX in it when it is closed, you must meet the following conditions:
the ActiveX container must be Ext. Window.
that is to say, if you place the ActiveX control in an Ext. Panel and then in Ext. window. Don't expect Ext. Window to take your ActiveX control together when it is closed.
Goodluck!

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.