Javascript - Local Storage with expiry options.
Most of the time, a local storage in HTML5 browsers is helpful to cache content from server for a certain period, Be it a dynamic menu, a big json data or a complex javascript object. All it need is to store in local storage for a certain period, collect data from local storage without hitting server again and again. But when the caching time lapses, the content should be retrieved fresh from the server. Below is a Javascript object which should be pretty much helpful to store and retrieve content in local storage with an optional time limit, expiring which, the returned value will be null instead, prompting us to get fresh data and store again. Moreover, it saves javascript objects to localstorage, with a certain prefix to identify object ( "_|_obj_|_" ), so that it can parse the value at the time of storing and retrieving the object var localStorageObj = { init : function () { this .$timeSuffix = "_lu" ; this .$expiryDuration = 1...