起因:升级了IE11之后部分页面刷新时会出现"SCRIPT5007: 缺少对象 "的报错,查看之后发现是Uploadify目前不支持IE11。
查询到修改源码以及在插件初始化前try catch调用释放插件对象的方法,但是依然会出现报错。
后来在stackoverflow上查询到可以在页面头部添加
<meta http-equiv="X-UA-Compatible" content="IE=edge" > 通过在meta中设置X-UA-Compatible的值,指定IE8/9及以后的版本都会以最高版本IE来渲染页面。
解决了问题。
付:
修改源码方法:
源代码:SWFUpload.prototype.cleanUp = function(a) {try {if (this.movieElement && typeof(a.CallFunction) === "unknown") {this.debug("Removing Flash functions hooks (this should only run in IE and should prevent memory leaks)");for (var c in a) {try {if (typeof(a[c]) === "function") {a[c] = null}} catch(b) {}}}} catch(d) {}window.__flash__removeCallback = function(e, f) {try {if (e) {e[f] = null}} catch(g) {}}};修正代码:SWFUpload.prototype.cleanUp = function(f) {try {if (this.movieElement && typeof(f.CallFunction) === "unknown") {this.debug("Removing Flash functions hooks (this should only run in IE and should prevent memory leaks)");for (var h in f) {try {if (typeof(f[h]) === "function" && h[0] >= 'A' && h[0] <= 'Z') {f[h] = null;}} catch(e) {}}}} catch(g) {}window.__flash__removeCallback = function(c, b) {try {if (c) {c[b] = null;}} catch(a) {}};};
2.
部分框架刷新后无法释放插件的对象,导致二次使用出现文件大小为0、上传文件队列累积等问题,该情况解决方法是:在插件初始化前try catch调用插件释放方法:
在 $('#file_upload').uploadify初始化之前,直接使用下面的效果更好
try {
$('#file_upload').uploadify('destroy');
}catch(e)
{
}