Mac Developer Library

Developer

WebKit Framework Reference WebHistoryItem Class Reference

Options
Deployment Target:

On This Page
Language:

WebHistoryItem

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.

Inheritance


Conforms To


Import Statement


Swift

import WebKit

Objective-C

@import WebKit;

Availability


Available in OS X v10.2 with Safari 1.0 and later.
Available in OS X v10.2.7 and later.
  • Initializes the receiver with a URL,URLString, a title specified by title and the last time this item was visited specified by time title, and time last visited.

    Declaration

    Swift

    init!(URLString URLString: String!, title title: String!, lastVisitedTimeInterval time: NSTimeInterval)

    Objective-C

    - (instancetype)initWithURLString:(NSString *)URLString title:(NSString *)title lastVisitedTimeInterval:(NSTimeInterval)time

    Discussion

    WebKit normally creates WebHistoryItem objects for you but on occasion you might want to create an item and add it to the WebBackForwardList yourself. Note that when an instance is first initialized the strings returned by URLString and originalURLString are the same.

    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.

  • Returns the string representation of the URL for the receiver’s page.

    Declaration

    Swift

    var URLString: String! { get }

    Objective-C

    @property(nonatomic, readonly, copy) NSString *URLString

    Discussion

    This URL may differ from the original URL if the page was, for example, redirected to a new location.

    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.

  • Returns the string representation of the original URL for the receiver’s page.

    Declaration

    Swift

    var originalURLString: String! { get }

    Objective-C

    @property(nonatomic, readonly, copy) NSString *originalURLString

    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.

    See Also

    – URLString

  • Returns the receiver’s original page title.

    Declaration

    Swift

    var title: String! { get }

    Objective-C

    @property(nonatomic, readonly, copy) NSString *title

    Discussion

    The title returned comes from the title HTML tag for HTML documents.

    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.

  • Returns an alternate title that may be used in place of the receiver’s page title.

    Declaration

    Swift

    var alternateTitle: String!

    Objective-C

    @property(nonatomic, copy) NSString *alternateTitle

    Discussion

    This method returns nil if no alternate title exists.

    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.

  • Sets an alternate title for a page.

    Declaration

    Swift

    var alternateTitle: String!

    Objective-C

    @property(nonatomic, copy) NSString *alternateTitle

    Discussion

    This is used as a convenience to display or store short versions of the page title.

    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.

  • Returns the icon for the receiver’s page, or nil if none exists.

    Declaration

    Swift

    var icon: NSImage! { get }

    Objective-C

    @property(nonatomic, readonly, strong) NSImage *icon

    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.

  • Returns the last time and date the receiver’s page was visited.

    Declaration

    Swift

    var lastVisitedTimeInterval: NSTimeInterval { get }

    Objective-C

    @property(nonatomic, readonly) NSTimeInterval lastVisitedTimeInterval

    Discussion

    The interval is from a reference date as determined by NSDate.

    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 by a WebHistoryItem object when the value of the history item’s title, alternate title, URL strings, or last visited interval changes.

    This notification does not contain a userInfo dictionary.

    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.