Icon TPersistentStorage

Unit: WebComps

Inherits From TObject

Available In: Client Applications

The TPersistentStorage object encapsulates the HTML5 local storage functionality, which allows the application to store name-value pairs of strings using the host web browser's storage facilities. This type of storage is preferable to cookies (TCookies) due to the fact that cookies are normally limited to around 4k of storage.

Information The component library includes two global instances of this class called LocalStorage and SessionStorage in the WebComps unit that should be used instead of creating new instances of the class. The LocalStorage instance represents the persistent local storage in the host web browser that is available across browser instances/sessions, whereas the SessionStorage instance represents the session-only storage in the host web browser that is cleared whenever the browser is closed.