Comments (5)
Its only a deprecation warning, but problematic to fix:
"Chrome 22 (current Canary) deprecates this feature by replacing it with sending ArrayBufferViews instead. JS Typed Arrays are just special ArrayBufferViews, so all this really means is that you can now send a typed array directly across the wire without touching its underlying buffer. This change is in match step with the recent updates to the XMLHttpRequest2 spec."
http://updates.html5rocks.com/2012/07/Arrived-xhr-send-ArrayBufferViews
try {
if (XMLHttpRequest.prototype.sendAsBinary) {
return;
}
XMLHttpRequest.prototype.sendAsBinary = function(datastr) {
function byteValue(x) {
return x.charCodeAt(0) & 0xff;
}
var ords = Array.prototype.map.call(datastr, byteValue);
var ui8a = new Uint8Array(ords);
this.send(ui8a.buffer);
};
} catch (e) {}
So instead of sending an ArrayBuffer on line 476
this.send(ui8a.buffer);
Remove the .buffer and send the typed array itself:
this.send(ui8a);
it removes the warning, but there isn't a check for older webkits that don't support sending ArrayBufferView..
possible solutions:
- check for browser and version(problematic)
- check on load if XMLHttpRequest.send accepts(ArrayBufferView)
Tested on:
Chrome Version 22.0.1229.94 m
Firefox 16.0.1
from jquery-filedrop.
Would a try() catch() around it work?
try {
this.send(ui8a);
} catch(error) {
this.send(ui8a.buffer);
}
from jquery-filedrop.
There isn't an error thrown but a console.warn() posted so nothing to catch..
Tested the removed '.buffer' code on Chrome 21 on OsX Lion and it silently failed.
No data was sent to the server.
Looks like it should be left in until the new W3C is widely accepted and you can rule out the older browser versions.
http://dvcs.w3.org/hg/xhr/raw-file/tip/Overview.html#dom-xmlhttprequest-send
There's probably a work around and it will haunt me for weeks...just short on time with current projects.
from jquery-filedrop.
Impacted by this as well... Is there a Modernizr feature detection for this?
from jquery-filedrop.
Not sure why, probably Array.prototype.map way already re-defined and extended by someone of the plugins I have already added on my page, but my Firefox 41.0.1 was blocking at:
var ords = Array.prototype.map.call(datastr, byteValue);
, that's why I modified the whole method to:
XMLHttpRequest.prototype.sendAsBinary = function(datastr) {
var nBytes = datastr.length, ui8a = new Uint8Array(nBytes);
for (var nIdx = 0; nIdx < nBytes; nIdx++) {
ui8a[nIdx] = datastr.charCodeAt(nIdx) & 0xff;
}
if ('ArrayBufferView' in window)
this.send(ui8a);
else
this.send(ui8a.buffer);
};
and this worked for me.
from jquery-filedrop.
Related Issues (20)
- Upload event doesn't work HOT 1
- uploading very large files (200 MB +) results in allocation size overflow HOT 1
- Upload directly to s3 bucket
- file.name HOT 1
- RangeError: Maximum call stack size exceeded. HOT 2
- If drop and change event are bind a $('input:file') element, drop event not work
- Make dropzone clicking triggering fallback configurable
- unicode characters are not supported
- afterAll doesn't fire if files are rejected HOT 1
- Button Click Open FileUpload Dialog available? HOT 1
- Drag and drop doesn't work in MS Edge on Win10
- 'BrowserNotSupported' alert on IE10+ HOT 2
- maxfiles can't work. HOT 2
- Inaccurate file sizes on drop
- Upload on button click HOT 2
- jQuery(...).filedrop is not a function with jQuery 3.1.1 HOT 10
- Not Found, error message while draging file into filedrop area.
- Upload .jfif images
- How to disable the upload HOT 1
- Disable Drag and Drop
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jquery-filedrop.