Skip to content

Instantly share code, notes, and snippets.

@chico
Created April 11, 2019 11:07
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save chico/61a79c44c07f768bb9fe1c63dec8dda1 to your computer and use it in GitHub Desktop.
Save chico/61a79c44c07f768bb9fe1c63dec8dda1 to your computer and use it in GitHub Desktop.
Get the size of localStorage, copied from https://stackoverflow.com/a/15720835, execute it in the JavaScript console
var _lsTotal=0,_xLen,_x;for(_x in localStorage){ if(!localStorage.hasOwnProperty(_x)){continue;} _xLen= ((localStorage[_x].length + _x.length)* 2);_lsTotal+=_xLen; console.log(_x.substr(0,50)+" = "+ (_xLen/1024).toFixed(2)+" KB")};console.log("Total = " + (_lsTotal / 1024).toFixed(2) + " KB");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment