这几天在做图片上传的东西,是用swfupload是出现了再IE9下那选择文件的按钮无法点击的情况,在其他浏览器,例如Firefox、chrome都不会出现,后来google一下才发下这算是IE9以上和flash的一个bug吧。
// Flash Satay object syntax: http://www.alistapart.com/articles/flashsatay
var myclass="";
if(navigator.userAgent.indexOf("MSIE")>0){
myclass='classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"';
}
return ['<object '+myclass+' 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("");
出现这种情况,需要在swfupload.js中的getFlahHTML方法修改一下,代码如下:
SWFUpload.prototype.getFlashHTML = function () {
// Flash Satay object syntax: http://www.alistapart.com/articles/flashsatay
var myclass="";
if(navigator.userAgent.indexOf("MSIE")>0){
myclass='classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"';
}
return ['<object '+myclass+' 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("");
};
本文转自 netcorner 博客园博客,原文链接: http://www.cnblogs.com/netcorner/p/3330164.html ,如需转载请自行联系原作者