My page generates a URL like this: "blob:http%3A//localhost%3A8383/568233a1-8b13-48b3-84d5-cca045ae384f"
How can I convert it to a normal address?
I'm using it as an <img>
's src
attribute.
My page generates a URL like this: "blob:http%3A//localhost%3A8383/568233a1-8b13-48b3-84d5-cca045ae384f"
How can I convert it to a normal address?
I'm using it as an <img>
's src
attribute.
As the previous answer have said, there is no way to decode it back to url, even when you try to see it from the chrome devtools panel, the url may be still encoded as blob.
However, it's possible to get the data, another way to obtain the data is to put it into an anchor and directly download it.
Insert this to the page containing blob url and click the button, you get the content.
Another way is to intercept the ajax call via a proxy server, then you could view the true image url.
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 adata:
URL, at least in Chrome. You can use an AJAX request to "fetch" the data from theblob:
URL (even though it's really just pulling it out of your browser's memory, not making an HTTP request).Here's an example:
data:
URLs are probably not what you mean by "normal" and can be problematically large. However they do work like normal URLs in that they can be shared; they're not specific to the current browser or session.another way to create a data url from blob url may be using canvas.
as what i saw in mdn, canvas.toDataURL is supported well by browsers. (except ie<9, always ie<9)