I experienced a bug where svg images could not be shown on Safari. After investigating I realized it was due to the fact that I load ressources as packs/archives of files that I split in the browser.
When I load the ressources, I get a plain text blob. I use blob.slice() to extract a ressource, passing the correct MIME type. However, it seems that the new blob does not have the correct MIME type but still the old one (plain text). On Chrome and Firefox, it turns out that the image can be displayed even if its MIME type is incorrect but not on Safari.
Here is the code which does not work:
const blob = new Blob([ressource], {
type: "text/plain",
});
const slicedBlob = blob.slice(0, blob.size, "image/svg+xml");
// slicedBlob.type is "text/plain"
I also reproduced some minimal test cases: https://jsbin.com/yavaxadalo/edit?js,output
From the MDN docs and the W3C specs it looks that I use the method as it is intended too, but maybe I am missing something ?