Update object stored in chrome extension’s local storage

Extensions can use a database: IndexedDB (the sample code may look convoluted, but it’s pretty simple in the actual extensions, for example two small functions here, getStyles and saveStyle, or IDB-keyval wrapper library). If you want to use chrome.storage, just maintain a global queue array that is populated by the server listener: queue.push(newItem); updateStorage(); and … 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

localStorage vs sessionStorage vs cookies

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 long as the session goes. Usually until the user closes the tab/browser. cookies are simply cookies, which are supported by older browsers and usually are a fallback for … Read more

Pass parameter between pages using jquery mobile

Data/Parameters manipulation between page transitions It is possible to send a parameter/s from one page to another during page transition. It can be done in few ways. Reference: https://stackoverflow.com/a/13932240/1848600 Solution 1: You can pass values with changePage: $.mobile.changePage(‘page2.html’, { dataUrl : “page2.html?paremeter=123”, data : { ‘paremeter’ : ‘123’ }, reloadPage : true, changeHash : true … 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