Be graceful about accessing localStorage/sessionStorage