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 ['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">',

                'this.settings.button_window_mode, '" />',

                'this.support.imageResize ?this.settings.flash_url : this.settings.flash9_url), '" />',

                '',

                '',

                'this.getFlashVars() + '" />',

                '

'
].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 ['', 
                '', 
                '', 
                '', 
                '', 
                '', 
                '', 
                '
'].join(""); 
};

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

你可能感兴趣的:(代码,swfupload,附件上传,浏览,IE9)