Store an array with chrome.storage.local

I think you’ve mistaken localStorage for the new Chrome Storage API. – You needed JSON strings in case of the localStorage – You can store objects/arrays directly with the new Storage API // by passing an object you can define default values e.g.: [] chrome.storage.local.get({userKeyIds: []}, function (result) { // the input argument is ALWAYS … Read more

local storage in IE9 fails when the website is accessed directly from the file system

Yeah, IE9 doesn’t support localStorage for local files. Not in any official documentation that I can find, but the same issue is described in this blog. You’ll have to either host the website externally, or find some other method of persisting data. [Support for HTML5-style local storage is still in beta in many browsers, anyway. … Read more

How can I request an increase to the HTML5 localstorage size on iPad, like the FT web app does?

I happen to know something about this 😉 There’s no API for requesting an increase in storage size for an existing database. There is one way to force an increase: write data to the database in such a size that an increase is required, prompting the user. However, this would be slow and there’s no … Read more

Saving and loading an image from localStorage

Something like this ? var img = new Image(); img.src=”https://stackoverflow.com/questions/19158887/mypicture.png”; img.load = function() { var canvas = document.createElement(‘canvas’); document.body.appendChild(canvas); var context = canvas.getContext(‘2d’); context.drawImage(img, 0, 0); var data = context.getImageData(x, y, img.width, img.height).data; localStorage.setItem(‘image’, data); // save image data }; Get the localStorage on the second page; try something like this: window.onload = function() { … Read more