I am saving a value in the local storage (html 5) in page 1 and then开发者_如何学C when i go to page 2, the values in the localstorage are gone. Could you please let me know what could be the issue?
Editing
I am actually using the following functions to set the data on the local storage
function set(key, data)
{
localStorage.setItem(key, data);
}
function get(key)
{
return localStorage.getItem(key); }
function remove(key) {
localStorage.removeItem(key); }
function clear() {
localStorage.clear();
}
I have issues getting it to work on Firefox and dont have any issues on Chrome. This looks like an entirely different issue. Thanks and Regards Abishek R Srikaanth
You don't provide enough detail to troubleshoot this properly, but check these things out:
- Are you previewing your design locally (e.g. via the file:// protocol), or are you on a proper web server? Only http:// requests will work accurately for you
- Local storage and Web SQL storage work by reference to the originating domain or IP address (again why point #1 is important): is your second page still in scope?
- What happens when you go back to page 1? Do the values re-appear?
精彩评论