(3 minute read)
The other browsers (Safari, Opera, Chrome) require the use of plugins to provide file system access, which is what I'll come onto next.
Data URI scheme
Neither of the previous options were really appearing. I set out searching for cross-browser ways of achieving what I wanted and came across the data URI scheme. This involves encoding the file contents as, say, the href attribute of an anchor tag as follows:
Support for this method is patchy across browsers and versions of IE older than 9 have a 32 KB limit in terms of the size of the resulting file. But the biggest downside is that you cannot set what the name of the file ought to be (see RFC2397).
I looked up TiddlyWiki and it is said to use a Java applet to save files when there are no proprietary file system APIs available. And that thing has been around for years so it would know what works best.
For use of the FileReader API I found some good resources:
- http://www.thebuzzmedia.com/html5-drag-and-drop-and-file-api-tutorial/ - up-to-date drag & drop tutorial.
- http://code.google.com/p/html5uploader/ - cross-browser file drag and drop upload library, though still won't work without a server on Safari.