Reputation: 761
I'm new to javascript, so I was wondering if it was possible to create a 'save changes' button in a web page?
e.g. The user types out some words and clicks the 'save changes' button, and the words are stored in some file somewhere which can be accessed later on.
Is this possible? If so how can I go about doing this? Thanks!
Upvotes: 2
Views: 1252
Reputation: 480
You could save to Local Storage.
Otherwise
You cannot do this purely in Javascript. Javascript running on browsers does not have enough permission yet (there have been proposals) due to security reasons.
Instead, I would recommend using https://github.com/dcneiner/Downloadify:
A tiny javascript + Flash library that enables the creation and download of text files without server interaction.
You can see a simple demo here where you supply the content and can test out saving/cancelling/error handling functionality.
Upvotes: 1
Reputation: 241
It can certainly be done.
You will either need a server-side language or if you have no problem with it being stricly server-side, then you can use Local Storage.
Both have various strengths and weaknesses in your situation. A serverside language is has a steep learning curve, but once you get to know it will provide you with so much more options, and possibilities that can not be done using clientside scripting.
Clientside scripting on the other hand has a somewhat lighter curve if you already do know some Javascript, but the weakness is that it's only on the current computer - You will be able to save data to the local storage, but if you change to another computer the data won't be available.
Upvotes: 1