Lifting the Lid on localStorage

Ever have one of those times where you’re reading one thing, and that leads you to another thing, which leads you to yet a THIRD thing, and before you know it you have four things you want to code and only enough energy to turn on the TV? And even then, once you get the TV on, you don’t have enough energy to find something else other than the Food Network to watch? I digress.

I have been doing a lot of research into This is a potentially powerful library. I’m looking at bringing it into use in my day job, but also see a lot of benefit for it in my personal projects as well. It doesn’t do anything that jQuery doesn’t already do, but that’s not the point. The point is that I find Amplify an excellent way to aggregate both the method of accessing Ajaxian/Restful endpoints, handling such cumbersome tasks as caching, as well as giving you a good cookie handler and pubsub mechanism, all in 8kb minified.

Admittedly, it’s in Alpha, and I hope to see it mature soon.

However, I was looking at how it handles things like localStorage, and then I saw a tweet from the substantially speedy Steve Souders regarding how he wanted to get a bookmarklet going to access localStorage. Well, after doing some research into how that could be done, I started working on one. So this post is the shameless plug post where I talk up AmplifyJS, and also the post where I talk about how I put one of those together.

I have (perhaps presumptuously) named this the jqLSAdmin. The ‘jq’ is because I use jQuery in it. The ‘LS’ denotes localStorage, and the ‘Admin’ part is because you can ‘administer’ your localStorage through the interface.

Bookmarklet: » jqLSAdmin «

Drag the bookmarklet up to your favorites bar in your browser of choice. When you are on a page where you would like to interact with the localStorage on that page, just click it. You will get a lightbox overlay on the page with the key/value pairs of your localStorage displayed. At the bottom of the list will be text boxes where  you can add new values to localStorage.

For those of you who may be concerned, I dynamically load in jQuery if it’s not already on the page, and if I did load it in I remove it when the bookmarklet is closed. I haven’t really worked the kinks out of noConflict() yet, so that isn’t handled in this release of this tool. However, as I experiment a bit further (or if someone wants to tackle it once I get the unminified code posted up), then please feel free.

Enjoy. Feedback is always appreciated.