IE9支持swfupload浏览按钮

打开swfupload.js文件找到307行开始的如下代码:

// Private: getFlashHTML generates the object tag needed to embed the flash in to the document

SWFUpload.prototype.getFlashHTML = function (flashVersion) {

    // Flash Satay object syntax: http://www.alistapart.com/articles/flashsatay

    return ['<object id="'this.movieName, '" type="application/x-shockwave-flash" data="', (this.support.imageResize ? this.settings.flash_url : this.settings.flash9_url),'" width="'this.settings.button_width, '" height="'this.settings.button_height, '" class="swfupload">',

                '<param name="wmode" value="',this.settings.button_window_mode, '" />',

                '<param name="movie" value="', (this.support.imageResize ?this.settings.flash_url : this.settings.flash9_url), '" />',

                '<param name="quality" value="high" />',

                '<param name="allowScriptAccess" value="always" />',

                '<param name="flashvars" value="' + this.getFlashVars() + '" />',

                '</object>'].join("");

};

总之找到SWFUpload.prototype.getFlashHTML = function (){}这个方法;

将其注掉,添加如下代码:

//Private: getFlashHTML generates the object tag needed to embed the flash in to the document 
SWFUpload.prototype.getFlashHTML = function () { 
    // Flash Satay object syntax: http://www.alistapart.com/articles/flashsatay 
    var classid = ""; 
    var Sys = {}; 
    var ua = navigator.userAgent.toLowerCase(); 


    if (window.ActiveXObject) 
        Sys.ie = ua.match(/msie ([\d.]+)/)[1]; 
    if (Sys.ie && Sys.ie.substring(0, 1) == "9") { 
        classid = 'clsid:d27cdb6e-ae6d-11cf-96b8-444553540000'; 
    } 
        return ['<object id="', this.movieName, '" classid="',classid,'"  type="application/x-shockwave-flash" data="', this.settings.flash_url, '" width="', this.settings.button_width, '" height="', this.settings.button_height, '" class="swfupload">', 
                '<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() + '" />', 
                '</object>'].join(""); 
};

经过测试IE9确实显示了浏览按钮,就可以上传附件了

猜你喜欢

转载自blog.csdn.net/apple1542/article/details/73604078