Don't forget the Chrome Dev Summit, starting Monday at 10:00am (Pacific) and streaming live on YouTube. Schedule.

Arrived! xhr.send(ArrayBufferViews)

And here you thought we were done improving XHR!

For a while now XHR2's overloaded send() method has supported sending a ArrayBuffer (a raw byte array).

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.

So for example, instead of sending an ArrayBuffer:

var xhr = new XMLHttpRequest();'POST', '/server', true);
xhr.onload = function(e) { ... };

var uInt8Array = new Uint8Array([1, 2, 3]);


Just send the typed array itself:


Eventually, sending ArrayBuffers will be removed, but for the time being you'll get console warnings when trying to send a buffer.

As always, you can keep up with these types of changes by following