解决SWFUpload 在IE9下无法加载的问题

时间:2022-09-15 17:36:01

打开swfupload.js,找到

SWFUpload.prototype.getFlashHTML = function ()

给object加上一个classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000",就可以乐。

具体代码如下,需要判断一下,不然在Chrome下又显示不出为鸟。

SWFUpload.prototype.getFlashHTML = function () {
    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 = 'classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"';
    }

    // Flash Satay object syntax: http://www.alistapart.com/articles/flashsatay
    return ['<object ', classid, ' 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">',
    '<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("");
};