Search code examples
cookiespreferencessettings

How to store user preferences in a web app?


i would like to know a good software engineering way to store user preferences in a web app. to clarify further, my app has commands that the user can choose, so i added a button that when some commands are selected, these commands are saved as favorites somewhere on the client's machine, that way if user X logs in at anytime he can check his favorite commands and load them automatically..

how to save these commands and where? and taking into consideration that several users using the same computer should not have access to each's favorites, so i want the favorite to be saved based on userID. where and how to save them? cookies? xml? and using php or javascript is better?

thx a lot for your help:)


Solution

  • Most typical would be to store them in a database of some sort on the server side, easily accessable by the UserID. Keep in mind 'preferences' are different from 'state'. State variables are usually stored via whatever cookie mechanism you are using.