Mac Developer Library

Developer

WebKit Framework Reference WebHistory Class Reference

Options
Deployment Target:

On This Page
Language:

WebHistory

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 web history items that were last visited on the specified date.

    Declaration

    Swift

    func orderedItemsLastVisitedOnDay(_ calendarDate: NSCalendarDate!) -> [AnyObject]!

    Objective-C

    - (NSArray *)orderedItemsLastVisitedOnDay:(NSCalendarDate *)calendarDate

    Parameters

    calendarDate

    The date on which the web history items were last visited.

    Return Value

    An array of web history items that were last visited on the specified date.

    Availability

    Available in OS X v10.2 with Safari 1.0 and later.

    Available in OS X v10.2.7 and later.

  • An array of all calendar days represented in the web history. (read-only)

    Declaration

    Swift

    var orderedLastVisitedDays: [AnyObject]! { get }

    Objective-C

    @property(nonatomic, readonly, copy) NSArray *orderedLastVisitedDays

    Availability

    Available in OS X v10.2 and later.

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

    Declaration

    Swift

    func itemForURL(_ URL: NSURL!) -> WebHistoryItem!

    Objective-C

    - (WebHistoryItem *)itemForURL:(NSURL *)URL

    Parameters

    URL

    The location, as a URL, of the webpage that was visited.

    Return Value

    The web history item that represents visits to the specified URL, or nil if none was found.

    Availability

    Available in OS X v10.2 with Safari 1.0 and later.

    Available in OS X v10.2.7 and later.

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

    Declaration

    Swift

    let WebHistoryItemsKey: String

    Objective-C

    extern NSString *WebHistoryItemsKey;

    Constants

    • WebHistoryItemsKey

      WebHistoryItemsKey

      The key to access an array containing the added or removed web history items.

      Available in OS X v10.2 and later.

    Discussion

    This string is used as the key in the userInfo dictionary passed as the argument to the WebHistoryAllItemsRemovedNotification, WebHistoryItemsAddedNotification, and WebHistoryItemsRemovedNotification notifications.

    Availability

    Available in OS X v10.2 with Safari 1.0 and later.

    Available in OS X v10.2.7 and later.

  • 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 NSArray object containing the removed items.

    Declaration

    Swift

    let WebHistoryAllItemsRemovedNotification: String

    Import Statement

    Objective-C

    @import WebKit;

    Swift

    import WebKit

    Availability

    Available in OS X v10.2 with Safari 1.0 and later.

    Available in OS X v10.2.7 and later.

  • 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 NSArray object containing the added items.

    Declaration

    Swift

    let WebHistoryItemsAddedNotification: String

    Import Statement

    Objective-C

    @import WebKit;

    Swift

    import WebKit

    Availability

    Available in OS X v10.2 with Safari 1.0 and later.

    Available in OS X v10.2.7 and later.

  • 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 NSArray object containing the removed items.

    Declaration

    Swift

    let WebHistoryItemsRemovedNotification: String

    Import Statement

    Objective-C

    @import WebKit;

    Swift

    import WebKit

    Availability

    Available in OS X v10.2 with Safari 1.0 and later.

    Available in OS X v10.2.7 and later.

  • 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.

    Declaration

    Swift

    let WebHistoryLoadedNotification: String

    Import Statement

    Objective-C

    @import WebKit;

    Swift

    import WebKit

    Availability

    Available in OS X v10.2 with Safari 1.0 and later.

    Available in OS X v10.2.7 and later.

  • 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.

    Declaration

    Swift

    let WebHistorySavedNotification: String

    Import Statement

    Objective-C

    @import WebKit;

    Swift

    import WebKit

    Availability

    Available in OS X v10.2 with Safari 1.0 and later.

    Available in OS X v10.2.7 and later.