Sunday, February 22, 2015

Emulate Database in HTML/Javascript - Here is the sample page/code

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

You can use this sample to build a full prototype site maintain the state of the customer and all the configuration. If you look at the javascript code in the below page, the key thing is the function that saves the encoded JSON string into multiple cookies by using a simple distribution in order not to run into individual cookie size limitation.

http://almirscorner.blogspot.com/p/emulate.html

NOTE: The dropdown selection does not properly work in IE because of one line of code. I know what to change, but I will not fix it yet. I figured this would be a good way to show a good interview question that you could ask in your company :)


Here is the full explanation of how it works:

http://almirscorner.blogspot.com/2015/02/emulate-database-in-client.html

- almirsCorner.com -

#html5 #javascript #coding #programming #code #programmer #softwaredevelopment #webdeveloper #database #almirsCorner

1 comment:

  1. The dropdown selection does not properly work in IE because of one line of code. I know what to change, but I will not fix it yet. I figured this would be a good way to show a good interview question that you could ask in your company :)

    ReplyDelete