Why does local storage not work?
I have recently decided on a small website I am working on that I want to try having switchable themes. I want the themes to persist past the session and I am not at the point of logins yet, so I am looking in to local storage.
The console log here confirms the function is being run, but no storage is created for the page.
var main = function() {
$('#theme1').click (function () {
localStorage.setItem("theme", "1");
console.log("click");
});
}
$(document).ready(main);
I have also tried localStorage.theme = "1";
to no avail.
I am on the latest Chrome, but despite it being obvious that html 5 is supported I have checked on the w3 website http://ift.tt/21GTL2S and running the code through their "Try it Yourself" system works.
Aucun commentaire:
Enregistrer un commentaire