0

I am making a website where you can store financial things. Just for practise. Not to publice. So far I have making the part where you can add a new list. And fill in things. But of course if I refresh the page it will be gone. So how can I save the new made list?

3
  • your question is incomplete, where is the code that you tried? Commented May 30, 2015 at 8:05
  • Could you also elaborate on how sensitive the financial data is? How long would you like it to be around for? Commented May 30, 2015 at 8:08
  • Google for "javascript persistent storage." That should get you started. Commented May 30, 2015 at 8:09

4 Answers 4

2

You could store it in the Browser via a cookie or better, localStorage. But of course if the browser deletes the "personal data" or you use a different browser, the data is gone.

Normally you would set up a server (say, PHP) and save it in a database (e.g. MySQL), even if you use the application only on your own machine.

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

1 Comment

If you really want to store data inside people's browsers, You may want to have a look at localforage. It's a mozilla library. You use it like localstorage, but it supports more modern (and faster) in-browser databases whenever possible.
1

Try using cookies or WebStorage (localstorage or sessionstorage objects). And consider using HTTPS if you working with financial info

Comments

0

You could use Firebase. Works great if you're only doing small things. Basically it allows you to store data online on their servers with the simple Firebase API.

Their tutorial should get you started: Firebase 5 minute tutorial

Comments

0

I am very new to learning localstorage myself and since you said "storeing in the browser" , i guess the best comtemporary and hassle and hack free method is localstorage .

Here is a accordion i made which stores the state of the accordion(weather its open or closed).

FIDDLE HERE

JS ::

$(function () {
    var initialCollapse = localStorage.collapse;


    if (initialCollapse) initialCollapse = initialCollapse.split(",")
    console.log(initialCollapse);
    $(".collapse-headings>a").click(function () {
        var div = $(this).parent();

        div.toggleClass("close open");


        $(".collapse-content", div).toggle("slow");

        localStorage.collapse = $(".collapse-headings").map(function () {
            return $(this).hasClass("open") ? "open" : "close"
        }).get()

        console.log(localStorage.collapse)
        return false;
    })
    if (initialCollapse) {
        $(".collapse-headings>a").each(function (i) {
            var div = $(this).parent();
            div.removeClass("close open").addClass(initialCollapse[i])

            $(".collapse-content", div).toggle(initialCollapse[i] !== "close");

        })
    }

});

This might be a good starting point to understanding localstorge , but if you do a google search , you'll come across a ton of useful information such as cross browser compatibility and local storage limitation and fallbacks.

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.