I was wondering, is it possible to read/write a file from/to a certain user directory using JavaScript and/or HTML5? E.g. a user fills in %USERPROFILE%\Documents\mydata.svg or ~/Documents/mydata.svg into a textfield, and the file is written.
Or would I have to be forced use a Java applet to do this?
Sidenote #1: If the solution only works in Google Chrome, that’s fine; but any webkit browser would be even better.
Sidenote #2: The location doesn’t really matter, as long as it’s the same location every time. It might as well be {sandboxed dir}\mydata.svg in this case, and then the user just doesn’t get an option where his/her data is stored.
In unprivileged content: no, not under any circumstances*. Good thing, too, or your computer would be rendered useless after 10 minutes on the internet.
If an extension would suffice, check out some related answers here: Writing to local file system in Chrome extension or Chrome extension: How to save a file on disk
Best practice would be to offer the SVG file as a download and let the user decide if and where to save it: http://www.benbarnett.net/2010/06/04/export-svg-from-raphael-js-to-create-a-png-bitmap/
(* – the File API is in draft and may be widely available in the future, but is currently only supported in Chrome. )