Here is a simple way to mock it with Jasmine: beforeEach(function () { var store = {}; spyOn(localStorage, 'getItem').andCallFake(function (key) { return store[key]; }); spyOn(localStora... Read More
If your goal is to store client-side and persistent data, you can't use the $cacheFactory, which just caches the data for the current session. One solution is to use the new local storage API. This a... Read More
Session Storage: Values persist only as long as the window or tab in which they stored. Values are only visible within the window or tab that created them. Local Storage: Values persist window and... Read More
I like the XSRF Double Submit Cookies method which mentioned in the article that @pkid169 said, but there is one thing that article doesn't tell you. You are still not protected against XSS because w... Read More
Since localStorage is a global object, you can add a watch in the dev tools. Just enter the dev tools, goto "watch", click on "Click to add..." and type in "localStorage".... Read More
Yes, use the File API, then you can process the images with the canvas element. This Mozilla Hacks blog post walks you through most of the process. For reference here's the assembled source code from... Read More
There is a very helpful extension to work with both localStorage and chrome.storage that I recently discovered, that works as a Dev Tools panel. Storage Area Explorer I did not write this, but it wa... Read More
localStorage and sessionStorage are both so-called WebStorages and features of HTML5. localStorage stores information as long as the user does not delete them. sessionStorage stores information as lo... Read More
In most of the modern single page applications, we indeed have to store the token somewhere on the client side (most common use case - to keep the user logged in after a page refresh). There are a to... Read More
Use this to clear localStorage: localStorage.clear();... Read More