javascript - 将本地存储项设置为键有反斜杠的浏览器
问题描述
我想将本地存储项设置为键有反斜杠的浏览器。例如,密钥看起来像
CognitoIdentityServiceProvider.\admin.idToken
我将以下查询与“双反斜杠 \\”一起使用,但它仍然在浏览器的 LocalStorage 中产生垃圾值。如果我们使用 console.log(CognitoIdentityServiceProvider.\\admin.idToken),它会在控制台中打印预期的输出,但在浏览器中,\ 无法识别。
browser.executeScript('localStorage.setItem("CognitoIdentityServiceProvider.\\admin","token")');
解决方案
推荐阅读
- laravel - 无法上传 Laravel 文件
- r - 理解函数分位数的问题
- node.js - 编写一个 docker 镜像但得到一个 npm ERR!EXDEV
- html - 使用 *ngFor 创建条件
- python - 如何加载保存的 TensorFlow 模型并对其进行评估
- animation - 为什么 NavigationView 中的动画从左上角开始?
- python - 每次for循环的交互如何创建新线程?
- php - Firestore PHP SDK - 如何保存日期?
- arrays - 无法将 appsettings IConfiguration 部分反序列化为类型化元素的数组
- html - 如何使用 HTML CSS 和 Bootstrap 4 使行和列容器垂直堆叠并为移动视图缩放