Reference: HTML5 Local Storage code example
Example 1: save to local storage
localStorage.setItem('myCat', 'Tom');
Example 2: save to local storage
var cat = localStorage.getItem('myCat');
localStorage.setItem('myCat', 'Tom');
var cat = localStorage.getItem('myCat');