Work even if localStorage throws a SECURITY_ERR (fixes #772)