Js Localstorage Available Space

[Solved] Js Localstorage Available Space | Shell - Code Explorer | yomemimo.com
Question : js localstorage available space

Answered by : bad-bear-l0ps7aqk67un

for (var i = 0, data = "m"; i < 40; i++) { try { localStorage.setItem("DATA", data); data = data + data; } catch(e) { var storageSize = Math.round(JSON.stringify(localStorage).length / 1024); console.log("LIMIT REACHED: (" + i + ") " + storageSize + "K"); console.log(e); break; }
}
localStorage.removeItem("DATA");

Source : https://stackoverflow.com/questions/3027142/calculating-usage-of-localstorage-space | Last Update : Sat, 03 Sep 22

Answers related to js localstorage available space

Code Explorer Popular Question For Shell