关于关闭TAB,IFRAME占用的内存不能释放问题

资料来源:http://jxd-zxf.iteye.com/blog/1440611

 

使用TAB时注意,如果TAB是引用IFRAME,关闭TAB时IFRAME不会被销毁从而导致内存不能释放,大量使用TAB+IFRAME容易导致内存溢出,所以使用TAB时,一定要把jsUtil.js引用到页面上

 1 $.fn.panel.defaults.onBeforeDestroy = function() {/* 回收内存 */
 2     var frame = $('iframe', this);
 3     if (frame.length > 0) {
 4         frame[0].contentWindow.document.write('');
 5         frame[0].contentWindow.close();
 6         frame.remove();
 7         if ($.browser.msie) {
 8             CollectGarbage();
 9         }
10      }
11 };

以上全局扩展方法会覆盖掉panel的onBeforeDestroy事件,自动把iframe销毁释放内存

原文地址:https://www.cnblogs.com/ljblog/p/7754522.html