问题
Using plupload, I get the following error when calling .start().
From this line:
I am using RequireJS to handle the libary. Using latest version (v2.1.2). My code:
How my script looks like:
define(['jquery', 'plupload'], function($) {
/**
* Init
*/
uploader = new plupload.Uploader({
runtimes: 'html5,flash,silverlight,html4', // gears,html5,flash,silverlight,browserplus
browse_button: 'uploadProfileImage',
max_file_size: '2mb',
url: ajax + 'uploadImage&temp=1',
flash_swf_url: website_url + 'assets/js/lib/plupload/Moxie.swf',
silverlight_xap_url: website_url + 'assets/js/lib/plupload/Moxie.xap',
filters: [
{
title: "Choose image",
extensions: "jpg,gif,png"
}
],
multipart_params : {
type: '1'
},
});
/**
* Init file upload
*/
uploader.bind('FilesAdded', function (up, files) {
uploader.start();
});
uploader.bind('QueueChanged', function (up, files) {
uploader.start();
up.refresh();
});
/**
* On callback (when file is uploaded)
*/
uploader.bind('FileUploaded', function(up, file, info) {
/**
* Handle callback...
*/
});
});
How my require config looks like:
requirejs.config({
paths: {
shim: {
plupload: {
exports: "plupload"
},
},
paths: {
jquery: [
'lib/jquery.min'
],
plupload: [
'lib/plupload.full.min'
],
}
}
});
The issues came up after migrating to RequireJS - previously it worked without issues.
回答1:
Turns out it is a problem with UA-Parser plugin. It thinks I am on Internet Explorer on Vista. But I am really on Chrome on OSX Yosemite.
This will in the end cause the function _getNativeXHR()
(in Plupload) to mistaken me for being on Internet Explorer and this causes the crash.
来源:https://stackoverflow.com/questions/25740050/uncaught-typeerror-cannot-read-property-open-of-undefined-after-calling