Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

swfupload not working under IE anymore

Tags:

swfupload

http://demo.swfupload.org/v250beta2/simpledemo/index.php doesn't seem to work in IE any more. Is there a fix for this?

I get a red cross instead and the 'button' is not clickable.

I'm running IE 8.

like image 950
sean Avatar asked Feb 05 '10 03:02

sean


1 Answers

I could reproduce the problem with IE9 running on Windows 7, but only on virtual machines. Anyway, I was able to apply a quick'n'dirty to fix the problem by patching swfupload.js (v2.2.0), somewhere around line 230, thanks to this post.

SWFUpload.prototype.getFlashHTML = function () {
    // Flash Satay object syntax: http://www.alistapart.com/articles/flashsatay

    // ADD THESE LINES --> 
    var iefix = '';
    if(navigator.userAgent.search(/MSIE/) > -1){
        iefix = 'classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"';
    }

    // MODIFY THIS LINE: (add ' + iefix + ')
    return ['<object ' + iefix + ' 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, '" />',
        ...

Seems that a very similar fix might help for 2.5.0.

EDIT: it seems that this fix wasn't enough for some VM's that have an IE add-on called "VMware Adobe Flash Optimizer" enabled. For some reason, the optimizer turns the Flash movie to a white box (which is actually clickable if you know to click it).

The bad news is that I found no way to detect or disable the presence of the optimizer add-on in my code. So I can't be sure whether the user actually sees the button or only a white box. I found no good workaround, only added a fallback link to a non-Flash uploading form.

like image 50
tuomassalo Avatar answered Jan 12 '23 00:01

tuomassalo