Creating Blobs and Blob URIs

You may also like...

5 Responses

  1. Kate says:

    Hi Dan, URL.createObjectURL is deprecated now, which is why this line
    var blobUrl = URL.createObjectURL(blob);
    isn’t working anymore. Do you have an idea how to solve this?

    • Dan says:

      Hi Kate, which browser are you using? I just tried it on Chrome 74 and Firefox 66 and it worked. You are right though that the API is deprecated. I’ll see what I can figure out. Thanks for pointing that out!

      Edit: I checked the API docs again and it looks like the URL.createObjectURL(stream) API has been deprecated. The URL.createObjectURL(blob) API still remains and so this code should work. See: https://developer.mozilla.org/en-US/docs/Web/API/URL/createObjectURL

  2. If i’m not wrong, Blob are create on client side(browser dependent) , So how can i manage to save a blob url and save it in DB. so that i can use that in future for all the browser.
    Waiting for you response.

    • Dan says:

      You are correct. Blobs are created on the client-side. You can’t save a blob URL to a database and expect it to work when you retrieve it. You will need to store the original source then load it as a blob.

  3. can a blog image can be created just with Html, CSS and javascript without Json?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.