Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

fix(avatar) refactor preloading to avoid CORS issues

Saúl Ibarra Corretgéc3a41b8cf364
diff --git a/react/features/base/participants/preloadImage.web.js b/react/features/base/participants/preloadImage.web.js
index 6e868cefc8..2316fee8ca 100644
--- a/react/features/base/participants/preloadImage.web.js
+++ b/react/features/base/participants/preloadImage.web.js
@@ -15,16 +15,13 @@ export function preloadImage(src: string | Object): Promise<string> {
}
return new Promise((resolve, reject) => {
- fetch(src, { referrer: '' })
- .then(response => {
- if (response.ok) {
- resolve(src);
- } else {
- reject();
- }
- })
- .catch(e => {
- reject(e);
- });
+ const image = document.createElement('img');
+
+ image.onload = () => resolve(src);
+ image.onerror = reject;
+
+ // $FlowExpectedError
+ image.referrerPolicy = 'no-referrer';
+ image.src = src;
});
}