简体   繁体   English

使用npm live-server时是否清除localStorage?

[英]Does the localStorage get cleared when working with npm live-server?

I am currently working on a basic JS application that requires the usage of DOM storage or localStorage. 我目前正在开发一个需要使用DOM存储或localStorage的基本JS应用程序。 In order to auto-save my changes, I incorporated the npm live-server. 为了自动保存我的更改,我合并了npm live-server。

After I shut down the live-server, I notice that the localStorage gets cleared. 关闭实时服务器后,我注意到localStorage已被清除。 Can you help me understand how this happens under the hood? 你能帮我理解这是怎么发生的吗?

localStorage is stored on the client side not on the server side, so each browser decides. localStorage存储在客户端而不是服务器端,因此每个浏览器都会决定。 Read at MDN: localStorage 在MDN上阅读: localStorage

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 npm live-server安装:symlink错误(即使以root / admin身份运行) - npm live-server install: symlink error (even when running as root/admin) 如何在 VSCode chrome live-server 中运行 npm 模块(puppeteer)? - How to run npm module (puppeteer) in a VSCode chrome live-server? 使用 npm 安装 live-server 包时出错。 `npm audit` 无助于解决问题 - Getting error while installing live-server package using npm. `npm audit` is not helping to fix the problem 何时清除 localStorage 或删除/移除数据? - When is localStorage cleared or data get deleted/removed? 是什么导致npm live-server停止检测文件更改? - What would cause npm live-server to stop detecting file changes? Node Live-server 突然停止工作,现在显示奇怪的东西 - Node Live-server suddendly stopped working and now is showing weird stuff 如何在运行实时服务器的情况下在 Visual Studio Code 中调试 JavaScript - How to Debug JavaScript in Visual Studio Code with live-server Running 关闭和打开应用程序的实时服务器会删除我的本地存储 - closing and opening live-server for an app deletes my local storage yarn eg:'live-server' 不被识别为内部或外部命令 - yarn eg:'live-server' is not recognized as an internal or external command 当应用程序通过实时服务器运行时,localStorage 是否应该保留? - Should localStorage persist when application is run via live server?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM