Return to Snippet

Revision: 41367
at February 17, 2011 03:00 by theshoveller


Initial Code
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);
}

Initial URL
http://javascript0.org/wiki/Portable_sendAsBinary

Initial Description
Use this to enhance non firefox browsers to support the sendAsBinary method.

Initial Title
Portable sendAsBinary for XHR

Initial Tags
html5

Initial Language
JavaScript