Local Storage Issues
- 2021年3月29日
- 技術情報
We use LocalStorage often in our web application to store data. But there are still some issues relating with local storage and you should consider a few facts before using this.
LocalStorage is a web storage object for storing data on the client, or local, or user’s computer. Locally stored data has no expiration date and remains until it is deleted. Local storage has caught the attention of developers as a lightweight solution for storing data that does not include databases or even a server.
But there are some down sides also to consider.
XSS vulnerabilities
Local storage has many similarities with cookies, including the same security risks. One of them makes it easy to do site scripting, which by stealing cookies allows a user to create a login session for a site. Storing something sensitive, such as a password, in a local storage file makes the process really easier for a hacker; Because they do not need to put cookies in their own browser.
Less Control
With local storage, there is no server-side storage or database that the developer can control. This can be a problem for several reasons. One is that once the code or information is saved, there is no way for the developer to update the code or information. The user has to delete the file manually and has to find the file. Alternatively, you need to clear your browser’s cache to lose all the stored data.
User might clear the storage
Clearing your browser’s cache on a regular basis will help browsers work more effectively. This is usually the first step you should take when troubleshooting browser issues such as pages not loading properly. This is a problem when using local storage to support the functionality of your site. When the user clears the browser cache, that information is completely lost.
As an alternative to local storage, there are several ways to handle this. For example – server side sessions, DB, and third party storage services etc.
Yuuma
yuuma at 2021年03月29日 11:02:42