Fix 404 issues in media-tag
This commit is contained in:
parent
01a3c13a8c
commit
d558b9e3e8
@ -96,11 +96,17 @@
|
|||||||
|
|
||||||
|
|
||||||
// Download a blob from href
|
// Download a blob from href
|
||||||
var download = function (src, cb) {
|
var download = function (src, _cb) {
|
||||||
|
var cb = function (e, res) {
|
||||||
|
_cb(e, res);
|
||||||
|
cb = function () {};
|
||||||
|
};
|
||||||
|
|
||||||
var xhr = new XMLHttpRequest();
|
var xhr = new XMLHttpRequest();
|
||||||
xhr.open('GET', src, true);
|
xhr.open('GET', src, true);
|
||||||
xhr.responseType = 'arraybuffer';
|
xhr.responseType = 'arraybuffer';
|
||||||
|
|
||||||
|
xhr.onerror = function () { return void cb("XHR_ERROR"); };
|
||||||
xhr.onload = function () {
|
xhr.onload = function () {
|
||||||
// Error?
|
// Error?
|
||||||
if (/^4/.test('' + this.status)) { return void cb("XHR_ERROR " + this.status); }
|
if (/^4/.test('' + this.status)) { return void cb("XHR_ERROR " + this.status); }
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user