How to open Blob URL on Chrome iOS with JavaScript?

Sometimes, we want to open Blob URL on Chrome iOS with JavaScript.

In this article, we’ll look at how to open Blob URL on Chrome iOS with JavaScript.

How to open Blob URL on Chrome iOS with JavaScript?

To open Blob URL on Chrome iOS with JavaScript, we can use the FileReader constructor.

For instance, we write:

const reader = new FileReader();
const out = new Blob(['abc'], {
  type: 'text/plain'
});
reader.onload = (e) => {
  console.log(reader.result)
}
reader.readAsDataURL(out);

We create a new FileReader instance.

Then we create a new Blob instance that we pass into the readAsDataURL method to read the blob into a base64 data URL.

Then in the reader.onload method, we get the data URL from the reader.result property.

Conclusion

To open Blob URL on Chrome iOS with JavaScript, we can use the FileReader constructor.