Added additional checks to make sure localStorage is really supported (fixes private browsing QUOTA_EXCEEDED_ERR issue in Safari)