I'm developing the following for local use:
I've got a HTML page, with some content.
Is it possible to edit the content of this HTML through the browser, and save the changes on-the-fly to this same file using only JavaScript? So the users could edit the file through the browser and it would auto-save itself.
The problem is, I have no possibility to use server-side languages here. It should be patible with the latest Firefox, other browsers aren't important.
I'm developing the following for local use:
I've got a HTML page, with some content.
Is it possible to edit the content of this HTML through the browser, and save the changes on-the-fly to this same file using only JavaScript? So the users could edit the file through the browser and it would auto-save itself.
The problem is, I have no possibility to use server-side languages here. It should be patible with the latest Firefox, other browsers aren't important.
Share Improve this question asked Dec 30, 2010 at 8:38 bogatyrjovbogatyrjov 5,3789 gold badges38 silver badges61 bronze badges 2- @Alin, you can generate pages only with javascript and with data ing from various sources. Especially for the browser he targets. – Mic Commented Dec 30, 2010 at 9:16
- Must have been blind at the moment. I missed the first line... "I'm developing the following for local use". – Alin P. Commented Dec 30, 2010 at 9:21
3 Answers
Reset to default 2Nope, you can't save server-side files using only native Javascript.
However, there seem to be some Java FTP Applets around that are scriptable from JavaScript. See this SO question.
Other than that, you need something on the server side receiving and writing the data.
No, this is not possible without backend code.
If the changes are only for that user, you can parse the data of the page and store them locally. Using some of the HTML5 goodies: http://diveintohtml5.ep.io/storage.html
Then, when the user es back, render it with a Javascript template engine.
My heart goes to PURE but there's plenty of other options if you prefer the double brackets family of templates.
If the changes are for all users, you could call a third server you own(appEngine, Amazon,...), to store the data, and deliver them through JSONP. And again render them with a JS template engine.