| 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, so 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 history object if specified.
+ (WebHistory *)optionalSharedHistory
Returns a shared history object, or nil if not previously specified using the setOptionalSharedHistory: method.
WebHistory.h
Sets the shared history object.
+ (void)setOptionalSharedHistory:(WebHistory *)history
WebHistory.hInserts or updates multiple WebHistoryItem objects.
- (void)addItems:(NSArray *)newItems
This method adds the WebHistoryItem objects specified by newItems to the receiver if they don’t already exist in the receiver. If an item in newItems already exists in the receiver then it will replace the existing item, so that the date the item was last visited is updated. Posts WebHistoryItemsAddedNotification if successful.
WebHistory.hReturns the maximum number of days that history will be stored by the receiver.
- (int)historyAgeInDaysLimit
WebHistory.hReturns the maximum number of items that will be stored by the receiver.
- (int)historyItemLimit
WebHistory.hReturn a history item matching a url.
- (WebHistoryItem *)itemForURL:(NSURL *)URL
This method returns the receiver’s WebHistoryItem object that matches the given URL, or nil if none was found.
WebHistory.hLoads contents from a file URL into the receiver.
- (BOOL)loadFromURL:(NSURL *)URL error:(NSError **)error
The file should have been previously created by a WebHistory object. The format of the file is private and should not be edited directly. The error argument is set to nil if the load was successful, otherwise error contains details of the failure. Returns YES if successful, NO otherwise.
WebHistory.hReturns WebHistoryItem objects last visited on a given date.
- (NSArray *)orderedItemsLastVisitedOnDay:(NSCalendarDate *)calendarDate
The history items are ordered from most recent to oldest.
WebHistory.hReturns an ordered list of non-empty calendar days included in the history.
- (NSArray *)orderedLastVisitedDays
This method returns an array of NSCalendarDate objects, each one representing a day that contains one or more history items managed by the receiver. Dates are ordered from most recent to oldest.
WebHistory.hRemoves all history items from the receiver.
- (void)removeAllItems
Posts WebHistoryAllItemsRemovedNotification if successful.
WebHistory.hRemoves multiple WebHistoryItem objects from the receiver.
- (void)removeItems:(NSArray *)items
Posts WebHistoryItemsRemovedNotification if successful.
WebHistory.hSaves the receiver to a file specified by URLits URL.
- (BOOL)saveToURL:(NSURL *)URL error:(NSError **)error
The file URL specified by URL must reference a file that is writable by the user. The format of the file is private and should not be edited directly. The error argument is set to nil if the save was successful, otherwise error contains details of the failure. Returns YES if successful, NO otherwise.
WebHistory.hSets the maximum number of days that the receiver stores history.
- (void)setHistoryAgeInDaysLimit:(int)limit
WebHistory.hSets the maximum number of history items that the receiver stores.
- (void)setHistoryItemLimit:(int)limit
WebHistory.hThis string is used as the key in the userInfo dictionary passed as the argument to the WebHistoryAllItemsRemovedNotification, WebHistoryItemsAddedNotification, and WebHistoryItemsRemovedNotification notifications.
Constant | Description |
|---|---|
WebHistoryItemsKey | An array containing the added or removed items depending on the type of notification. |
Posted when all history items have been removed from the web history. The notification object is the WebHistory the history items were removed from. The userInfo dictionary contains the following information:
Key |
Value |
|---|---|
@”WebHistoryItemsKey” |
An NSArray containing the removed items. |
WebHistory.h
Posted when items have been added to a web history. The notification object is the WebHistory that items were added to. The userInfo dictionary contains the following information:
Key |
Value |
|---|---|
@”WebHistoryItemsKey” |
An NSArray containing the added items. |
WebHistory.h
Posted when items have been removed from the web history. The notification object is the WebHistory that the history items were removed from. The userInfo dictionary contains the following information:
Key |
Value |
|---|---|
@”WebHistoryItemsKey” |
An NSArray containing the removed items. |
WebHistory.h
Posted when web history items have been loaded from a URL. The notification object is the WebHistory 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 WebHistory that saved the history items. This notification does not contain a userInfo dictionary.
WebHistory.h
Last updated: 2006-05-23