Search code examples
javascriptlocal-storagenpm-live-serverbrowser-close

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. In order to auto-save my changes, I incorporated the npm live-server.

After I shut down the live-server, I notice that the localStorage gets cleared. Can you help me understand how this happens under the hood?


Solution

  • localStorage is stored on the client side not on the server side, so each browser decides. Read at MDN: localStorage