JSFiddle - React, Tailwind, and code Playground

by Alex Alex

HTML

<h3>
    Reproducing a bug when opening unknown Blob content types
  </h3>

<ol>
    <li> <a id="normalBlob" target="_blank">Click here</a> to open a text/plain Blob in a new window.</li>
    <li>It should say "I am a plaintext blob!" just fine in the newly created window. Note that you can reload that new window and it will show the text over and over again.</li>
    <li> <a id="weirdBlob" target="_blank">Click here</a> to open an octet-stream Blob in a new window.</li>
    <li>The octet-stream will <i>not</i> work and even <b>destroy all other working</b> Blobs. Go ahead and reload the text/plain Window now again and you'll see that it's gone.</li>
</ol>

JavaScript

var normalBlob = new Blob(["I am a plaintext blob!"], {
        type: 'text/plain'
    });
    var normalBlobURL = URL.createObjectURL(normalBlob);
    var normalBlobLink = document.getElementById("normalBlob");
    normalBlobLink.href = normalBlobURL;

    var weirdBlob = new Blob(["I am a weird blob!"], {
        type: 'application/octet-stream'
    });
    var weirdBlobURL = URL.createObjectURL(weirdBlob);
    alert(weirdBlobURL.toString());
    var weirdBlobLink = document.getElementById("weirdBlob");
    weirdBlobLink.href = weirdBlobURL;