Blocked By AdBlock

Why does Adblock block all blobs?

by Zachary Shuford

HTML

<p>
  The following won't open if you have an adblocker:
</p>

<a style="display: none" id="blob-link" href="" target="_blank">Click Me!</a>

<p>
  But you can manually copy/paste this and it'll work:
</p>

<div id="my-div"></div>

JavaScript

const myString = "Hello World!";
const blob = new Blob([myString], {
  type: 'text/plain'
});
const fileURL = URL.createObjectURL(blob);
const myLink = document.getElementById("blob-link");
myLink.setAttribute("href", fileURL);
myLink.style.display = "block";

document.getElementById("my-div").innerText = myLink;