if(window.localStorage){
$('input,textarea').keyup(function () {
var val = $(this).val();
var key = window.location.href+'_'+$(this).attr('name')
localStorage.setItem(key,val);
});
$('input,textarea').each(function () {
var key = window.location.href+'_'+$(this).attr('name')
var cache = localStorage.getItem(key);
if(cache) {
$(this).val(cache);
}
})
} else {
console.log('浏览器不支持storage缓存')
}