| Inherits from | |
| Conforms to | |
| Framework | /System/Library/Frameworks/WebKit.framework |
| Availability | Available in Mac OS X v10.2 with Safari 1.0 and later. Available in Mac OS X v10.2.7 and later. |
| Companion guide | |
| Declared in | WebHistory.h |
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:).
Returns a shared web history object, if one exists.
+ (WebHistory *)optionalSharedHistory
A shared web history object initialized with the default web history file, or nil if one was not previously specified using the setOptionalSharedHistory: method.
WebHistory.h
Sets the web history object to share.
+ (void)setOptionalSharedHistory:(WebHistory *)history
The web history object to share.
WebHistory.hInserts or updates the specified items in the web history.
- (void)addItems:(NSArray *)newItems
An array of web history items to add. If an item in the array already exists in the web history this method replaces the existing item, so that the last-visited date for the item is updated.
When successful, this method posts a notification (WebHistoryItemsAddedNotification).
WebHistory.hReturns the maximum age of web history items that can be retrieved.
- (int)historyAgeInDaysLimit
The maximum age, in days, of web history items that can be retrieved.
WebHistory.hReturns the maximum number of web history items that can be stored.
- (int)historyItemLimit
The maximum number of web history items that can be stored.
WebHistory.hReturns the web history item that corresponds to the specified web location.
- (WebHistoryItem *)itemForURL:(NSURL *)URL
The location, as a URL, of the webpage that was visited.
The web history item that represents visits to the specified URL, or nil if none was found.
WebHistory.hLoads the contents of the specified web history file.
- (BOOL)loadFromURL:(NSURL *)URL error:(NSError **)error
The URL of the file to load. The file should have been created previously by a web history object. Note that the file’s format is private and should not be edited directly.
On output, nil if the load was successful; otherwise, error, contains details of the failure.
YES if successful; otherwise, NO.
When successful, this method posts a notification (WebHistoryLoadedNotification).
WebHistory.hReturns web history items that were last visited on the specified date.
- (NSArray *)orderedItemsLastVisitedOnDay:(NSCalendarDate *)calendarDate
The date on which the web history items were last visited.
An array of web history items that were last visited on the specified date.
WebHistory.hReturns all calendar days represented in the web history.
- (NSArray *)orderedLastVisitedDays
An array of calendar days, in order from most recent to oldest. Each calendar day is associated with at least one web history item.
WebHistory.hRemoves all items from the web history.
- (void)removeAllItems
When successful, this method posts a notification (WebHistoryAllItemsRemovedNotification).
WebHistory.hRemoves the specified items from the web history.
- (void)removeItems:(NSArray *)items
An array of web history items to remove.
When successful, this method posts a notification (WebHistoryItemsRemovedNotification).
WebHistory.hSaves the web history to the specified file.
- (BOOL)saveToURL:(NSURL *)URL error:(NSError **)error
The URL of the file to contain the web history information. The file must be user-writable, but its format is private and should not be edited directly.
On output, nil if the load was successful; otherwise, error, which contains details of the failure.
YES if successful; otherwise, NO
When successful, this method posts a notification (WebHistorySavedNotification).
WebHistory.hSets the maximum age of web history items that can be retrieved.
- (void)setHistoryAgeInDaysLimit:(int)limit
The maximum age, in days, of retrievable web history items.
WebHistory.hSets the maximum number of web history items to store.
- (void)setHistoryItemLimit:(int)limit
The maximum number of web history items to store.
WebHistory.hThe key for accessing the web history items stored in a notification’s user information dictionary.
extern NSString *WebHistoryItemsKey;
WebHistoryItemsKeyThe key to access an array containing the added or removed web history items.
Available in Mac OS X v10.2 and later.
Declared in WebHistory.h.
This string is used as the key in the userInfo dictionary passed as the argument to the WebHistoryAllItemsRemovedNotification, WebHistoryItemsAddedNotification, and WebHistoryItemsRemovedNotification notifications.
WebHistory.h
Posted when all history items have been removed from the web history.
The notification object is the web history from which the history items were removed. The userInfo dictionary contains the following information:
Key |
Value |
|---|---|
@”WebHistoryItemsKey” |
An |
WebHistory.h
Posted when history items have been added to a web history.
The notification object is the web history to which the items were added. The userInfo dictionary contains the following information:
Key |
Value |
|---|---|
@”WebHistoryItemsKey” |
An |
WebHistory.h
Posted when items have been removed from the web history.
The notification object is the web history from which the history items were removed. The userInfo dictionary contains the following information:
Key |
Value |
|---|---|
@”WebHistoryItemsKey” |
An |
WebHistory.h
Posted when web history items have been loaded from a URL.
The notification object is the web history that loaded the history items. This notification does not contain a userInfo dictionary.
WebHistory.h
Posted when web history items have been saved to a URL.
The notification object is the web history that saved the history items. This notification does not contain a userInfo dictionary.
WebHistory.h
Last updated: 2009-03-04