Sensitive data will almost never be stored on the client. If you cannot guarantee the physical security of the computer and / or guarantee that the registered user on this computer will only ever use the computer (both of which are usually NOT true), then do not store confidential information on the client if you can avoid this.
It is much safer to store confidential information on the server and require the appropriate credentials before providing this information to the browser. You can then control the physical security of the data on your server and prevent users from accessing data that does not belong to them. In addition, you can protect it in flight using SSL.
If you really want to store something locally, accessible only to one user and one computer and one browser on this computer, you can request a password and use this password to encrypt / decrypt data stored in local storage. With the exception of temporary offline action, I currently donβt know why it would be better than on a server where it can be accessed by this user, regardless of how they access the Internet. These days of mobile access, access to tablets, access to a laptop, etc ... it seems that the tendency is to store things in the cloud so that a given user can access his data through any means of accessing the Internet that they can use, rather than requiring them to use the same computer.
jfriend00
source share