65

I'm using safari, and unsure if this works in other browsers, but when I signed up for a storm path account, I see the following URL

blob:https://api.stormpath.com/1be95204-93d6-4GUID HERE

The blob: prefix is new to me and I want to know if it works across all browsers, and what other prefixes might exist.

1
  • 2
    There is a good explanation at SO
    – Bakudan
    Jun 7, 2017 at 16:36

4 Answers 4

31

Blob URI/URL was created by JavaScript, refers to data that your browser currently has in memory (only in current page), and does not refer to data the exists on the host.

For more information to use, see: https://www.npmjs.com/package/blob-util

15

The start of a URL up to the first colon is called a "URI scheme" (or "URL scheme"). Googling for blob URI scheme reveals the W3C's File API efforts.

Most URI schemes don't have standard provisions for containing a whole other URI, so you wouldn't think of them as prefixing another whole URI. Besides http: and https:, some common URI schemes include:

  • ftp:
  • mailto:
  • data:
  • script:
  • smb: (and cifs: )
  • afp:

…and many more. I'm sure I'm leaving out everyone's favorites. :)

13

I copy and paste the answer from StackOverflow because of background info about blob in URL string.

A URL that was created from a JavaScript Blob can not be converted to a "normal" URL.

A blob: URL does not refer to data the exists on the server, it refers to data that your browser currently has in memory, for the current page. It will not be available on other pages, it will not be available in other browsers, and it will not be available from other computers.

Therefore it does not make sense, in general, to convert a Blob URL to a "normal" URL. If you wanted an ordinary URL, you would have to send the data from the browser to a server and have the server make it available like an ordinary file.

It is possible convert a blob: URL into a data: URL, at least in Chrome. You can use an AJAX request to "fetch" the data from the blob: URL (even though it's really just pulling it out of your browser's memory, not making an HTTP request).

1
  • 3
    would you please explain how to convert a blob: URL into a data: URL in Chrome using AJAX to "fetch" the data? Or perhaps point me to a tutorial? I cannot for the life of me figure it out. Thanks!
    – Bee Smears
    Jan 12, 2020 at 0:47
3

MDN is a good resource for understanding things in plain language. I would also suggest https://developer.mozilla.org/en-US/docs/Web/API/URL/createObjectURL as a good resource. They also show the W3C specification at the bottom of their page, the same one as Spiff provided, but the original specifications can be verbose and difficult to read. I would say Spiff is the most correct for linking you to the W3C docs.

I don't think that the link to npmjs that Masoud provided is very useful. It directs you to a Javascript library on the library host npmjs. The blob-util library is used to wrap around the standard API in the browser to work with blobs and it simplified writing code for these things, but it is not a good reference to understand the blob URLs and what they are.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .