I am trying to check the html5 localStorage function. For some reason, when I try to get the value from the repository after the page is refreshed, I only get null returns. (If I try to get the values ββin the same function in which I installed them, then I can restore them correctly).
One thing: the html / javascript that I am loading is being requested from the local disk (for example, I use the line: "file: /// C: /testLocalStore.html" to go to the file, instead of requesting it from the web server.This will cause local storage problems that i see?
(I would like to publish a complete code example, but I'm having formatting issues. I will send it shortly).
<html> <head> <title>test local storage</title> <base href="http://docs.jquery.com" /> <script src="http://code.jquery.com/jquery-1.3.js"></script> <script type="text/javascript"> function savestuff() { var existingData = localStorage.getItem("existingData"); if( existingData === undefined || existingData === null ) { </script> </head> <body> <form id="loadFromUser" onsubmit="savestuff();"> <input id="mapName" type="text"> <input type="submit" value="save"> </form> <div id="existingData"> </div> </body> </html>
source share