【保存する場合】
var opt = {
browser: 'Chrome',
OS: 'Mac OS 10.8.2'
};
localStorage.setItem('data', JSON.stringify(opt));
browser: 'Chrome',
OS: 'Mac OS 10.8.2'
};
localStorage.setItem('data', JSON.stringify(opt));
【読み込む場合】
var data = JSON.parse(localStorage.getItem('data'));
console.log(data);
console.log(data);
【結果】

No comments:
Post a Comment
Note: Only a member of this blog may post a comment.