![]() If the data is text or an image, the browser can open the file, instead of saving it to disk. Most web browsers have support for object URLs, Opera Mini is the only one that does not support them. The blob is stored inside the browser until either URL.revokeObjectURL() is called on the URL or the document that created it is closed. This returns an URL that can be used to retrieve the contents of the blob. Another option to save client-side generated files, is to put their contents in a Blob (or File) object and create a download link using URL.createObjectURL(blob). Long data URIs can give performance problems in browsers. ![]() (Though it's a perfectly valid answer for anyone doing a "real" web app.) That being the case it looks like I'm out of luck unless I want to involve the server. : I didn't mention it upfront, so the posters who answered "Flash" are valid enough, but part of what I'm doing is an attempt to highlight what can be done with pure HTML5. All of which should be "safe" activities as far as the browser is concerned. Is there any way that I could present the user with a download using pure JavaScript? (I doubt it, but might as well ask.)Īnd to be clear: I am not trying to access the filesystem without the users knowledge! The user will provide a file (probably via drag and drop), the script will transform the file in memory, and the user will be prompted to download the result. But in reality the server has nothing to do with this particular process, so why get it involved? I already have the contents of the desired file in memory. Now, I know that I can parse the file, send the result to the server, and have the browser request the file back from the server as a download. I already have the code to parse the file in JavaScript, so I may as well use it as my exporter too! The problem is saving. Problem is it's pretty slow (Collada is a very verbose format), so I'm going to start converting files to a easier to use format (probably JSON). I've been fiddling with WebGL lately, and have gotten a Collada reader working.
0 Comments
Leave a Reply. |