I wonder if there is any way I can write to files from HTML5/JS? In the broswer ...
As far as I know, you can't write to files from HTML5, because giving a web page access to the user's files would be a security risk.
If you just need to store some data so your page can access it later, HTML5 does have something called Web Storage which can do that.
Or you could store the data in cookies (if it's very small) or on the server.