Home > Article > Web Front-end > HTML study notes three (use of localstorage)_html/css_WEB-ITnose
Use of localstorage
var localstroage = window.localStorage;
localstroage.setItem('openid','ksjhfkjajkdfjkszdjfksad'); localstroage.setItem('uid','10001');
var openid = localstroage.getItem('openid');
localstroage.removeItem('openid');
localstroage.clear();
localStorage.uid = 1;localStorage.sex='nan';localStorage.age = 23;for ( var i = 0, len = localStorage.length; i < len; ++i ) { console.log( localStorage.key( i ) +':' + localStorage.getItem(localStorage.key( i )) );}
2. Localstorage supports almost all browsers without considering the issue size of IE8 which is 5M