I came across an issue today where a colleague had saved some data locally that I needed to use, and it seemed there wasn't an easy way to transfer the data across. Luckily a few minutes of fiddling showed it was in fact super-easy.
Just write out the total contents of the localStorage file as a JSON string, email or otherwise transfer it to the other computer, and then read it back into localStorage.
Here's the code. I ran this by opening the JavaScript console in my browser and just typed the commands
// Write out the whole contents of the localStorage..
JSON.stringify(localStorage);
// Copy the output..
// Now on the other computer, read it in again..
var storage = !! PASTE THE DATA HERE !!;
for (var name in storage) { localStorage.setItem(name, storage[name] ); }
http://www.nuff-respec.com/technology/cross-browser-cookies-with-flash
ReplyDeletethank you for this code!
ReplyDeletecode examples for beginner webmasters
ReplyDeletecss and html Font size relative larger