This should by wrapped in `try{} catch{}` because this may throw e.g. in Safari (at least on iOS 6) in private mode. There are other uses of `localStorage` here that are not wrapped, too.