UpLoadify在IE下兼容问题

Posted chenze-index

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了UpLoadify在IE下兼容问题相关的知识,希望对你有一定的参考价值。

一、在IE9、IE10不能点击的问题解决

解决方法:进入uploadify的js文件中,搜索SWFUpload.prototype.getFlashhtml,找到它对应的语句,将方法全部替换为以下内容:

    SWFUpload.prototype.getFlashHTML = function () {  
        // Flash Satay object syntax: http://www.alistapart.com/articles/flashsatay  
        var obj = [‘<object id="‘, this.movieName, ‘" type="application/x-shockwave-flash" data="‘, this.settings.flash_url, ‘" width="‘, this.settings.button_width, ‘" height="‘, this.settings.button_height, ‘" class="swfupload">‘].join(""),  
    params = [  
    ‘<param name="wmode" value="‘, this.settings.button_window_mode, ‘" />‘,  
    ‘<param name="movie" value="‘, this.settings.flash_url, ‘" />‘,  
    ‘<param name="quality" value="high" />‘,  
    ‘<param name="menu" value="false" />‘,  
    ‘<param name="allowScriptAccess" value="always" />‘,  
    ‘<param name="flashvars" value="‘, this.getFlashVars(), ‘" />‘  
    ].join("");  
        if (navigator.userAgent.search(/MSIE/) > -1) {  
            obj = [‘<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="‘, this.movieName, ‘" width="‘, this.settings.button_width, ‘" height="‘, this.settings.button_height, ‘" class="swfupload">‘].join("");  
            params += ‘<param name="src" value="‘ + this.settings.flash_url + ‘" />‘;  
        }  
        return [obj, params, ‘</object>‘].join("");  
    };  

二丶jQuery运行时错误:“没有对象”

解决方法:进入uploadify的js文件中,搜索SWFUpload.prototype.cleanUp ,找到它对应的语句,在方法中对应的位置添加红色部分内容:

    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) {}
        };
    };

 

以上是关于UpLoadify在IE下兼容问题的主要内容,如果未能解决你的问题,请参考以下文章

解决Chrome浏览器和IE浏览器上传附件兼容的问题 -- Chrome关闭flash后,uploadify插件不可用的解决办法

使用datepicker和uploadify的冲突解决(IE双击才能打开附件上传对话框)

兼容ie8,firefox,chrome浏览器的代码片段

解决uploadify插件不同浏览器下的兼容性问题

解决jQuery uploadify在非IE核心浏览器下无法上传

uploadify 火狐不兼容问题解决方案