WARNING: Most of this content (with the exception of the Mozilla 1.9 XPCOM reference) is very old, and can be expected to be out of date and possibly obsolete. For better XUL documentation, please visit the XUL hub at the Mozilla Developer Center.

nsISHistoryListener

IID:3b07f591-e8e1-11d4-9882-00c04fa02f40
Inherits From:nsISupports
Status:FROZEN

nsISHistoryListener defines the interface one can implement to receive notifications about activities in session history and to be able to cancel them.

A session history listener will be notified when pages are added, removed and loaded from session history. It can prevent any action (except adding a new session history entry) from happening by returning false from the corresponding callback method.

A session history listener can be registered on a particular nsISHistory instance via the nsISHistory::addSHistoryListener() method.


Methods

PRBool OnHistoryGoBack ( nsIURI backURI ) PRBool OnHistoryGoForward ( nsIURI forwardURI ) PRBool OnHistoryGotoIndex ( PRInt32 index , nsIURI gotoURI ) void OnHistoryNewEntry ( nsIURI newURI ) PRBool OnHistoryPurge ( PRInt32 numEntries ) PRBool OnHistoryReload ( nsIURI reloadURI , PRUint32 reloadFlags )

PRBool OnHistoryGoBack ( nsIURI backURI )

Called when navigating to a previous session history entry, for example due to a nsIWebNavigation::goBack() call.

Arguments:
backURI: The URI of the session history entry being navigated to.
Returns:
Whether the operation can proceed.

PRBool OnHistoryGoForward ( nsIURI forwardURI )

Called when navigating to a next session history entry, for example due to a nsIWebNavigation::goForward() call.

Arguments:
forwardURI: The URI of the session history entry being navigated to.
Returns:
Whether the operation can proceed.

PRBool OnHistoryGotoIndex ( PRInt32 index , nsIURI gotoURI )

Called when navigating to a session history entry by index, for example, when nsIWebNavigation::gotoIndex() is called.

Arguments:
index: The index in session history of the entry to be loaded.
gotoURI: The URI of the session history entry to be loaded.
Returns:
Whether the operation can proceed.

void OnHistoryNewEntry ( nsIURI newURI )

Called when a new document is added to session history. New documents are added to session history by docshell when new pages are loaded in a frame or content area, for example via nsIWebNavigation::loadURI()

Arguments:
newURI: The URI of the document to be added to session history.

PRBool OnHistoryPurge ( PRInt32 numEntries )

Called when entries are removed from session history. Entries can be removed from session history for various reasons, for example to control the memory usage of the browser, to prevent users from loading documents from history, to erase evidence of prior page loads, etc.

To purge documents from session history call nsISHistory::PurgeHistory()

Arguments:
numEntries: The number of entries to be removed from session history.
Returns:
Whether the operation can proceed.

PRBool OnHistoryReload ( nsIURI reloadURI , PRUint32 reloadFlags )

Called when the current document is reloaded, for example due to a nsIWebNavigation::reload() call.

Arguments:
reloadURI: The URI of the document to be reloaded.
reloadFlags: Flags that indicate how the document is to be refreshed. See constants on the nsIWebNavigation interface.
Returns:
Whether the operation can proceed.

References

This interface is the type of the following properties:

nsISHistoryInternal.listener

This interface is passed as an argument to the following methods:

nsISHistory.addSHistoryListener, nsISHistory.removeSHistoryListener

Reference documentation is generated from Mozilla's source.