WebHistoryItem Class Reference

Inherits from
Conforms to
Framework
/System/Library/Frameworks/WebKit.framework
Availability
Available in OS X v10.2 with Safari 1.0 and later.
Available in OS X v10.2.7 and later.
Companion guide
Declared in
WebHistoryItem.h
Related sample code

Overview

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.

Adopted Protocols

NSCopying

Tasks

Initializing WebHistoryItem Objects

Getting URL Information

Getting and Setting Page Titles

Getting Other Attributes

Instance Methods

alternateTitle

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

- (NSString *)alternateTitle
Discussion

This method returns nil if no alternate title exists.

Availability
  • Available in OS X v10.2 with Safari 1.0 and later.
  • Available in OS X v10.2.7 and later.
Declared In
WebHistoryItem.h

icon

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

- (NSImage *)icon
Availability
  • Available in OS X v10.2 with Safari 1.0 and later.
  • Available in OS X v10.2.7 and later.
Declared In
WebHistoryItem.h

initWithURLString:title:lastVisitedTimeInterval:

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.

- (id)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.

Availability
  • Available in OS X v10.2 with Safari 1.0 and later.
  • Available in OS X v10.2.7 and later.
Declared In
WebHistoryItem.h

lastVisitedTimeInterval

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

- (NSTimeInterval)lastVisitedTimeInterval
Discussion

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

Availability
  • Available in OS X v10.2 with Safari 1.0 and later.
  • Available in OS X v10.2.7 and later.
Declared In
WebHistoryItem.h

originalURLString

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

- (NSString *)originalURLString
Availability
  • Available in OS X v10.2 with Safari 1.0 and later.
  • Available in OS X v10.2.7 and later.
Declared In
WebHistoryItem.h

setAlternateTitle:

Sets an alternate title for a page.

- (void)setAlternateTitle:(NSString *)alternateTitle
Discussion

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

Availability
  • Available in OS X v10.2 with Safari 1.0 and later.
  • Available in OS X v10.2.7 and later.
Declared In
WebHistoryItem.h

title

Returns the receiver’s original page title.

- (NSString *)title
Discussion

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

Availability
  • Available in OS X v10.2 with Safari 1.0 and later.
  • Available in OS X v10.2.7 and later.
Related Sample Code
Declared In
WebHistoryItem.h

URLString

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

- (NSString *)URLString
Discussion

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

Availability
  • Available in OS X v10.2 with Safari 1.0 and later.
  • Available in OS X v10.2.7 and later.
Related Sample Code
Declared In
WebHistoryItem.h

Notifications

WebHistoryItemChangedNotification

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.

Availability
See Also
Declared In
WebHistoryItem.h