+
+/*\
+|*|
+|*| :: XMLHttpRequest.prototype.sendAsBinary() Polifyll ::
+|*|
+|*| https://developer.mozilla.org/en-US/docs/DOM/XMLHttpRequest#sendAsBinary()
+|*|
+\*/
+
+if (!XMLHttpRequest.prototype.sendAsBinary) {
+ XMLHttpRequest.prototype.sendAsBinary = function (sData) {
+ var nBytes = sData.length, ui8Data = new Uint8Array(nBytes);
+ for (var nIdx = 0; nIdx < nBytes; nIdx++) {
+ ui8Data[nIdx] = sData.charCodeAt(nIdx) & 0xff;
+ }
+ /* send as ArrayBufferView...: */
+ this.send(ui8Data);
+ /* ...or as ArrayBuffer (legacy)...: this.send(ui8Data.buffer); */
+ };
+}