nsIWebNavigation

IID:F5D9E7B0-D930-11d3-B057-00A024FFC08C
Inherits From:nsISupports
Status:UNDER_REVIEW

The nsIWebNavigation interface defines an interface for navigating the web. It provides methods and attributes to direct an object to navigate to a new location, stop or restart an in process load, or determine where the object has previously gone.

This interface is implemented by the following components:


Constants

This flags defines the range of bits that may be specified.
PRUint32 LOAD_FLAGS_MASK = 65535
This is the default value for the load flags parameter.
PRUint32 LOAD_FLAGS_NONE = 0
This flag specifies that the load should have the semantics of an HTML Meta-refresh tag (i.e., that the cache should be bypassed). This flag is only applicable to loadURI. XXX the meaning of this flag is poorly defined. XXX no one uses this, so we should probably deprecate and remove it.
PRUint32 LOAD_FLAGS_IS_REFRESH = 16
This flag specifies that the load should have the semantics of a link click. This flag is only applicable to loadURI. XXX the meaning of this flag is poorly defined.
PRUint32 LOAD_FLAGS_IS_LINK = 32
This flag specifies that history should not be updated. This flag is only applicable to loadURI.
PRUint32 LOAD_FLAGS_BYPASS_HISTORY = 64
This flag specifies that any existing history entry should be replaced. This flag is only applicable to loadURI.
PRUint32 LOAD_FLAGS_REPLACE_HISTORY = 128
This flag specifies that the local web cache should be bypassed, but an intermediate proxy cache could still be used to satisfy the load.
PRUint32 LOAD_FLAGS_BYPASS_CACHE = 256
This flag specifies that any intermediate proxy caches should be bypassed (i.e., that the content should be loaded from the origin server).
PRUint32 LOAD_FLAGS_BYPASS_PROXY = 512
This flag specifies that a reload was triggered as a result of detecting an incorrect character encoding while parsing a previously loaded document.
PRUint32 LOAD_FLAGS_CHARSET_CHANGE = 1024
If this flag is set, Stop() will be called before the load starts and will stop both content and network activity (the default is to only stop network activity). Effectively, this passes the STOP_CONTENT flag to Stop(), in addition to the STOP_NETWORK flag.
PRUint32 LOAD_FLAGS_STOP_CONTENT = 2048
A hint this load was prompted by an external program: take care!
PRUint32 LOAD_FLAGS_FROM_EXTERNAL = 4096
This flag specifies that all network activity should be stopped. This includes both active network loads and pending META-refreshes.
PRUint32 STOP_NETWORK = 1
This flag specifies that all content activity should be stopped. This includes animated images, plugins and pending Javascript timeouts.
PRUint32 STOP_CONTENT = 2
This flag specifies that all activity should be stopped.
PRUint32 STOP_ALL = 3

Properties

readonly PRBool canGoBack

Indicates if the object can go back. If true this indicates that there is back session history available for navigation.

readonly PRBool canGoForward

Indicates if the object can go forward. If true this indicates that there is forward session history available for navigation

readonly nsIURI currentURI

The currently loaded URI or null.

readonly nsIDOMDocument document

Retrieves the current DOM document for the frame, or lazily creates a blank document if there is none. This attribute never returns null except for unexpected error situations.

readonly nsIURI referringURI

The referring URI for the currently loaded URI or null.

nsISHistory sessionHistory

The session history object used by this web navigation instance.


Methods

void goBack ( ) void goForward ( ) void gotoIndex ( PRInt32 index ) void loadURI ( PRUnichar* URI , PRUint32 loadFlags , nsIURI referrer , nsIInputStream postData , nsIInputStream headers ) void reload ( PRUint32 reloadFlags ) void stop ( PRUint32 stopFlags )

void goBack ( )

Tells the object to navigate to the previous session history item. When a page is loaded from session history, all content is loaded from the cache (if available) and page state (such as form values and scroll position) is restored.


void goForward ( )

Tells the object to navigate to the next session history item. When a page is loaded from session history, all content is loaded from the cache (if available) and page state (such as form values and scroll position) is restored.


void gotoIndex ( PRInt32 index )

Tells the object to navigate to the session history item at a given index.

Arguments:
index

void loadURI ( PRUnichar* URI , PRUint32 loadFlags , nsIURI referrer , nsIInputStream postData , nsIInputStream headers )

Loads a given URI. This will give priority to loading the requested URI in the object implementing this interface. If it can't be loaded here however, the URI dispatcher will go through its normal process of content loading.

Arguments:
URI: The URI string to load. For HTTP and FTP URLs and possibly others, characters above U+007F will be converted to UTF-8 and then URL- escaped per the rules of RFC 2396.
loadFlags: Flags modifying load behaviour. This parameter is a bitwise combination of the load flags defined above. (Undefined bits are reserved for future use.) Generally you will pass LOAD_FLAGS_NONE for this parameter.
referrer: The referring URI. If this argument is null, then the referring URI will be inferred internally.
postData: If the URI corresponds to a HTTP request, then this stream is appended directly to the HTTP request headers. It may be prefixed with additional HTTP headers. This stream must contain a "\r\n" sequence separating any HTTP headers from the HTTP request body. This parameter is optional and may be null.
headers: If the URI corresponds to a HTTP request, then any HTTP headers contained in this stream are set on the HTTP request. The HTTP header stream is formatted as: ( HEADER "\r\n" )* This parameter is optional and may be null.

void reload ( PRUint32 reloadFlags )

Tells the Object to reload the current page. There may be cases where the user will be asked to confirm the reload (for example, when it is determined that the request is non-idempotent).

Arguments:
reloadFlags: Flags modifying load behaviour. This parameter is a bitwise combination of the Load Flags defined above. (Undefined bits are reserved for future use.) Generally you will pass LOAD_FLAGS_NONE for this parameter.

void stop ( PRUint32 stopFlags )

Stops a load of a URI.

Arguments:
stopFlags: This parameter is one of the stop flags defined above.

References

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

nsICharsetResolver.requestCharset, nsIDragDropHandler.hookupTo, nsIWebNavigationInfo.isTypeSupported

Reference documentation is generated from Mozilla's source.

Add a note User Contributed Notes
August 26, 2005, 4:17 pm ian at ithomas dot name
When you define your <browser> or <tabbrowser> xul tag, it is important to specify either type="content" or type="content-primary"

If you don't specify either, then many of these methods will return NS_ERROR_FAILURE

Copyright © 1999 - 2005 XULPlanet.com