Export (0) Print
Expand All

IPersistHistory Interface

Provides a mechanism for a component to persist its state in its containing application during the current session.

IPersistHistory Members

GetPositionCookie Copies a saved vertical scroll position into the specified address.
LoadHistory Restores the state of the component.
SaveHistory Saves the state of a component.
SetPositionCookie Saves a vertical scroll position.


The IPersistHistory interface is implemented by a component to maintain its state across navigations in a browser. For example, a user enters data into a Web-based form containing intrinsic controls and a custom edit control. The user navigates away from the page, and then returns during the current browser session to find that the data entered into the custom component is lost, while the intrinsic controls have maintained their state.

When a user navigates away from a page, all controls on the page are queried for IPersistHistory. The controls that implement the interface are handed a stream through the SaveHistory method, in which they can store their current state. If the page is loaded again during the current browser session, each control is handed a stream through the LoadHistory method from which they can reload their previous state.

Windows Internet Explorer uses up to two MB of persistent data for all controls. When this limit is exceeded, the least recently used data is discarded. Component developers should respect the requirements of other controls and limit their use of the history cache.

This interface replaces the four-page cache implemented by Microsoft Internet Explorer 3.0.

Interface Information

Stock Implementation None
Custom Implementation Yes
Inherits from IPersist
Header and IDL files Perhist.h, Perhist.idl
Minimum availability Internet Explorer 4.0
Minimum operating systems Windows 95, Windows NT 4.0

Community Additions

© 2014 Microsoft