if(window.localStorage)
{
var 剩余空间 = 1024 * 1024 * 5 - unescape(encodeURIComponent(JSON.stringify(localStorage))).length;

alert(剩余空间);
}



剩余空间单位是b



清除localstorage:

localStorage.clear();

Created with the Personal Edition of HelpNDoc: Single source CHM, PDF, DOC and HTML Help creation