jQuery File Upload doesn't work in IE9 when compressed with Requirejs

喜欢而已 提交于 2019-12-08 00:57:42

问题


My code uses Backbone with Requirejs and jQuery File Upload and works perfectly in IE 9 when I access the development code directly (without building). As soon as I build it something goes wrong and the request is sent empty to the server.

The only difference I see in the request (using Network capturing in IE9) is that the one that works when I click in the upload button, the Initiator is click, and for the one that fails, the initiator is JS Library XMLHttpRequest.

So there must be something making the event change when the code gets compressed, but I have no idea how to get closer to the root of the problem.

Any ideas?


回答1:


Are you requiring the iFrame Transport plugin?

I am using jQuery File Upload with Requirejs, and have not seen this issue. Without seeing some code, it is hard to say what is tripping up your application. I suggest updating your question with some relevant code. In the meantime, here is what is working for me.

main.js

require.config({
    appDir: '../',
    baseUrl: 'js/',
    paths: {
        underscore: '../vendor/lodash.underscore',
        backbone: '../vendor/backbone',
        'jquery.fileupload': '../vendor/jquery-file-upload/js/jquery.fileupload',
        'jquery.iframe-transport': '../vendor/jquery-file-upload/js/jquery.iframe-transport',
        'jquery.ui.widget': '../vendor/jquery-file-upload/js/jquery.ui.widget'
    },
    shim: {
        underscore: {
            exports: '_'
        },
        backbone: {
            deps: ['underscore', 'jquery'],
            exports: 'Backbone'
        }
    }
});

And in the page that houses the upload control:

UploadPage.js

define([
    'views/Base',
    'jquery.iframe-transport',
    'jquery.fileupload'
], function(BaseView) {
    return BaseView.extend({
        // Do cool stuff
    });
});


来源:https://stackoverflow.com/questions/17533108/jquery-file-upload-doesnt-work-in-ie9-when-compressed-with-requirejs

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!