[client][js] detect localStorage properly before use to avoid access denied exception