Check if browser support localStorage

fixes #1144 
updated. Thanks!