这几天在做图片上传的东西,是用swfupload是出现了再IE9下那选择文件的按钮无法点击的情况,在其他浏览器,例如Firefox、chrome都不会出现,后来google一下才发下这算是IE9和flash的一个bug吧。
出现这种情况,需要在swfupload.js中的getFlahHTML方法修改一下,代码如下:
SWFUpload.prototype.getFlashHTML = function (flashVersion) { // Flash Satay object syntax: http://www.alistapart.com/articles/flashsatay var obj = ['<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">'].join(""), params = [ '<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="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.support.imageResize ? this.settings.flash_url : this.settings.flash9_url) + '" />'; } return [obj, params, '</object>'].join(""); };
google code地址: