WebHistory objects are used to maintain the pages visited by users. Visited pages are represented by WebHistoryItem objects. You add and remove history items using the addItems: and removeItems: methods. These methods post appropriate notifications when items are added or removed so you can update the display. WebHistory organizes the WebHistoryItem objects by the day they were visited, ordered from most recent to oldest. You can request all the days that contain history items using the orderedLastVisitedDays method or request the items visited on a particular day using the orderedItemsLastVisitedOnDay: method. WebHistory objects can be loaded and saved by specifying a file URL (see loadFromURL:error:).


@interface WebHistory : NSObject


Accessing Shared History Objects

+ optionalSharedHistory

Returns a shared web history object, if one exists.

+ setOptionalSharedHistory:

Sets the web history object to share.

Adding and Removing History Items

- addItems:

Inserts or updates the specified items in the web history.

- removeItems:

Removes the specified items from the web history.

- removeAllItems

Removes all items from the web history.

Getting Web History Items

- orderedItemsLastVisitedOnDay:

Returns web history items that were last visited on the specified date.


An array of all calendar days represented in the web history.

- itemForURL:

Returns the web history item that corresponds to the specified web location.

Loading and Saving History Information

- loadFromURL:error:

Loads the contents of the specified web history file.

- saveToURL:error:

Saves the web history to the specified file.

Getting and Setting Attributes


The maximum age of web history items that can be retrieved.


The maximum number of web history items that can be stored.


Web History Dictionary Keys

The key for accessing the web history items stored in a notification’s user information dictionary.



Posted when all history items have been removed from the web history.


Posted when history items have been added to a web history.


Posted when items have been removed from the web history.


Posted when web history items have been loaded from a URL.


Posted when web history items have been saved to a URL.


Inherits From

See Also

Accessing Previous Webpages (Legacy)


A WebBackForwardList object maintains a list of visited pages used to go back and forward to the most recent page. A WebBackForwardList object maintains only the list data—it does not perform actual page loads (in other words, it does not make any client requests). If you need to perform a page load, see the loadRequest: method in WebFrame to find out how to do this.


WebHistoryItem objects encapsulate information about visiting a page so that users can return to that page. WebHistory and WebBackForwardList objects manage lists of WebHistoryItem objects. WebHistoryItem objects are created and added to these lists automatically when loading pages, so you do not need to create WebHistoryItem objects directly.