try {
if (!window.localStorage)
throw new Error('LocalStorage disabled');
localStorage.setItem('scrollTop', window.pageYOffset); //write
alert('Current scroll: ' + localStorage.getItem('scrollTop')); //read
} catch (e) {
!!window.console && !!console.error && console.error(e);
}