Implement better feature detection for blob fetch. · blueimp/JavaScript-Load-Image@771e022 · GitHub | Latest TMZ Celebrity News & Gossip | Watch TMZ Live
Skip to content

Commit 771e022

Browse files
committed
Implement better feature detection for blob fetch.
1 parent 9d43954 commit 771e022

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

js/load-image-fetch.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,12 @@
2727

2828
var global = loadImage.global
2929

30-
if (global.fetch && global.Request) {
30+
if (
31+
global.fetch &&
32+
global.Request &&
33+
global.Response &&
34+
global.Response.prototype.blob
35+
) {
3136
loadImage.fetchBlob = function (url, callback, options) {
3237
/**
3338
* Fetch response handler.
@@ -52,8 +57,11 @@
5257
callback(null, err)
5358
})
5459
}
55-
} else if (global.XMLHttpRequest && global.ProgressEvent) {
56-
// Browser supports XHR Level 2 and XHR responseType blob
60+
} else if (
61+
global.XMLHttpRequest &&
62+
// https://xhr.spec.whatwg.org/#the-responsetype-attribute
63+
new XMLHttpRequest().responseType === ''
64+
) {
5765
loadImage.fetchBlob = function (url, callback, options) {
5866
/**
5967
* Promise executor

0 commit comments

Comments
 (0)

TMZ Celebrity News – Breaking Stories, Videos & Gossip

Looking for the latest TMZ celebrity news? You've come to the right place. From shocking Hollywood scandals to exclusive videos, TMZ delivers it all in real time.

Whether it’s a red carpet slip-up, a viral paparazzi moment, or a legal drama involving your favorite stars, TMZ news is always first to break the story. Stay in the loop with daily updates, insider tips, and jaw-dropping photos.

🎥 Watch TMZ Live

TMZ Live brings you daily celebrity news and interviews straight from the TMZ newsroom. Don’t miss a beat—watch now and see what’s trending in Hollywood.