2

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!

1
  • yes, you can write the data into a text file or other format of your choice and read it in future using javascript Commented Jul 10, 2016 at 7:10

2 Answers 2

1

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.

Sign up to request clarification or add additional context in comments.

Comments

1

You could save to Local Storage.

http://www.w3schools.com/html/html5_webstorage.asp

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.