JSFiddle - React, Tailwind, and code Playground
by Martin MalĂ˝
JavaScript
function listStorage(){
for (var i=0;i<localStorage.length;i++){
document.write(i+": "+localStorage.key(i)+'<br>');
}
document.write('<hr>');
}
function handle_storage(e) {
//if (!e) { e = window.event; }
console.log(e.key);
alert(e);
}
if (window.addEventListener) {
window.addEventListener("storage", handle_storage, false);
} else {
window.attachEvent("onstorage", handle_storage);
};
localStorage.clear();
localStorage.setItem("a", 1);