try-catch saving into localStorage

Added a try around setItem to prevent [IE11 issues](http://stackoverflow.com/questions/21155137/javascript-localstorage-object-broken-in-ie11-on-windows-7) and to prevent errors being thrown if localStorage gets maxed out.