I'm trying to find a cross browser way to store data locally in HTML5. I have generated a chunk of data in a Blob (see MDN). Now I want to move this Blob to the actual filesystem and save it locally. I've found the following ways to achieve this;
- Use the
<a download>
attribute. This works only in Chrome currently.
- Microsoft introduces a
saveAs
function in IE 10 which will achieve this.
- Open the Blob URL in the browser and save it that way.
None of these seems to work in Safari though. While (1) works in Chrome, (2) in IE and (3) in Firefox no one works in Safari 6. The download attribute is not yet implemented and when trying to open a blob using the URL Safari complains that URLs starting with blob:
are not valid URLs.
There is a good script that encapsulates (1) and (3) called FileSaver.js but that does not work using the latest Safari version.
Is there a way to save Blobs locally in a cross browser fashion?
question from:
https://stackoverflow.com/questions/12802109/download-blobs-locally-using-safari 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…