Listing localstorage

Posted by Blondie on Stack Overflow See other posts from Stack Overflow or by Blondie
Published on 2010-05-15T17:22:29Z Indexed on 2010/05/15 17:34 UTC
Read the original article Hit count: 339

I did my own feature using this:

function save(title, url)
{
 for (var i = 1; i < localStorage.length; i++) 
 {
  localStorage["saved-title_" + i + ""] = title;
  localStorage["saved-url_" + i + ""] = url;
 } 
}

function listFavs()
{
 for (var i = 1; i < localStorage.length; i++) {
    console.log(localStorage["saved-fav-title_" + i + ""]);
 }
}

save() happens when someone clicks on this:

onclick="save(\'' + title + '\', \'' + tab.url + '\');"> ' + title + '</a>';

However... it doesn't show the saved localStorages, how am I supposed to make it work?

© Stack Overflow or respective owner

Related posts about localstorage

Related posts about JavaScript