Are there any benefits to Session Storage over Local Storage?

localStorage and sessionStorage both extend Storage. There is no difference between them except for the intended “non-persistence” of sessionStorage. That is, the data stored in localStorage persists until explicitly deleted. Changes made are saved and available for all current and future visits to the site. For sessionStorage, changes are only available per tab. Changes made … Read more

How to sync chrome extension options

In the (hopefully near) future, you’ll be You are now able to store stuff in chrome.storage.sync, and it will be synced automagically. Unless you need something right now, do consider putting all your configurations in an single object, sometime later you’ll be able to just sync it! Edit: now this is available in stable Chrome!

Is it possible to store integer value in localStorage like in Javascript objects and extract it without typecasting?

My question is it possible to store integer value inside localStorage as I can do for Javascript objects without typecasting? No. Storage objects are simple key-value stores, similar to objects, but they stay intact through page loads. The keys can be strings or integers, but the values are always strings. [source]

export Data in localStorage for later re-import

Here’s how to import/export your entire localStorage Export copy(JSON.stringify(localStorage)); This will copy your localStorage to your clipboard. (You need two JSON.stringify()’s to get the quotes escaped.) Import var data = JSON.parse(/*paste stringified JSON from clipboard*/); Object.keys(data).forEach(function (k) { localStorage.setItem(k, JSON.stringify(data[k])); });

Storing compressed json data in local storage

As localStorage functionality seems to be limited to handle only string key/value pairs what you can do is to use lz-string library to stringify the json object and compress it before storing it in localStorage Usage // sample json object var jsonobj = {‘sample’: ‘This is supposed to be ling string’, ‘score’: ‘another long string … Read more