Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

nsISHistoryListener

An interface you can implement to receive notifications about activities that occur in session history, and optionally cancel them.
Inherits from: nsISupports Last changed in Gecko 1.7

A session history listener is notified when pages are added to, removed from, and loaded from session history. The listener 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.

Method overview

boolean OnHistoryGoBack(in nsIURI aBackURI);
boolean OnHistoryGoForward(in nsIURI aForwardURI);
boolean OnHistoryGotoIndex(in long aIndex, in nsIURI aGotoURI);
void OnHistoryNewEntry(in nsIURI aNewURI);
boolean OnHistoryPurge(in long aNumEntries);
boolean OnHistoryReload(in nsIURI aReloadURI, in unsigned long aReloadFlags);

Methods

OnHistoryGoBack()

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

boolean OnHistoryGoBack(
  in nsIURI aBackURI
);
Parameters
aBackURI
The URI of the session history entry being navigated to.
Return value

true to allow the go back operation to proceed or false to cancel it.

OnHistoryGoForward()

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

boolean OnHistoryGoForward(
  in nsIURI aForwardURI
);
Parameters
aForwardURI
The URI of the session history entry being navigated to.
Return value

true to allow the go forward operation to proceed or false to cancel it.

OnHistoryGotoIndex()

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

boolean OnHistoryGotoIndex(
  in long aIndex,
  in nsIURI aGotoURI
);
Parameters
aIndex
The index in session history of the entry to be loaded.
aGotoURI
The URI of the session history entry to be loaded.
Return value

true to allow the operation to proceed or false to cancel it.

OnHistoryNewEntry()

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

Note: You can't cancel this operation.
void OnHistoryNewEntry(
  in nsIURI aNewURI
);
Parameters
aNewURI
The URI of the document to be added to session history.

OnHistoryPurge()

Called when entries are removed from session history. Entries can be removed from session history for various reasons; for example to control the browser's memory usage, 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().

boolean OnHistoryPurge(
  in long aNumEntries
);
Parameters
aNumEntries
The number of entries to be removed from session history.
Return value

true to allow the purge operation to proceed or false to cancel it.

OnHistoryReload()

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

boolean OnHistoryReload(
  in nsIURI aReloadURI,
  in unsigned long aReloadFlags
);
Parameters
aReloadURI
The URI of the document to be reloaded.
aReloadFlags
Flags that indicate how the document is to be refreshed. See the nsIWebNavigation interface's load constants.
Return value

true to allow the reload operation to proceed or false to cancel it.

Document Tags and Contributors

 Contributors to this page: Sheppy, MatrixFrog
 Last updated by: Sheppy,