Emulate Database in JS

Emulate Database in Client HTML/Javascript code ??

Emulating database feel in the client HTML/Javascript code is a good option if you want to quickly prototype something while working with your product owners. You can build pages with forms and submit that data from page to page and emulate the concept of saving the data and that data can be used in other pages. This can be all handled within plain HTML files and Javascript code without server-side code.


To achieve this, the following needs to be done:


Let me comment more on how you would save that information into cookies. The size of this data would cross the limits of cookie sizes. Every time you decide to save your Javascript object into cookies, you can do the following:

Here is the example. You can refresh the page and close the browser and it will still maintain the updates you made as it is using a collection of cookies to emulate database.