Last Updated: February 25, 2016
· Kresimir Pendic

Use localstorage, bye, bye cookie's

If you need to store some data on client browser, try this new localstorage html5 feature that is so super easy to use, and it doesn't need any lib like jquery or similar..

Setting the variable:

localStorage.setItem('name', 'john')

Get variable:


Set object:

var nestedTable = [{
    key1: "val1",
    key2: "val2",
    key3: {
        tableId: "tblIdNested1",
        tableClassName: "clsNested",
        linkText: "Download",
        data: [{
            subkey1: "subval1",
            subkey2: "subval2",
            subkey3: "subval3"

localStorage.setItem('obj1', JSON.stringify(nestedTable))

Get the object like stringifyed json,

that's it,

hth, cheers :)