- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
if (/Version\/5[^S]+Safari/.test(navigator.userAgent)) {
// https://twitter.com/sonnypiers/status/187513545397776384
var xhr = new XMLHttpRequest();
xhr.open('GET', user_photo, true);
xhr.responseType = 'arraybuffer';
xhr.onload = function(e) {
if (this.status == 200) {
var uInt8Array = new Uint8Array(this.response);
var i = uInt8Array.length;
var binaryString = new Array(i);
while (i--) {
binaryString[i] = String.fromCharCode(uInt8Array[i]);
}
var data = binaryString.join('');
var base64 = window.btoa(data);
var image = new Image();
image.onload = function() {
...
};
image.src = 'data:image/jpeg;base64,' + base64;
}
};
xhr.send();
return;
}
var image = new Image();
image.onload = function() {
...
};
image.crossOrigin = 'anonymous';
image.src = user_photo;
Dummy00001 07.12.2015 12:06 # +1
старый софт не умеет новые фичи. news at 11.
makc3d 07.12.2015 12:12 # +1
Dummy00001 07.12.2015 13:29 # 0
в строке 24 появится `this.getResponseHeader('content-type')`?
makc3d 07.12.2015 13:40 # 0
Dummy00001 07.12.2015 13:45 # 0