Home > Element Reference : Browser

Contents

### Browser

An iframe which is expected to contain a read-only view of a Web document.

Most of the properties and methods of the browser would rarely be used and can only be called from chrome URLs. Other URLs will need to use the document and history objects to change the displayed document.

#### Attributes:

Attributes inherited from XUL Element

#### Properties and Methods:

Properties and Methods inherited from XUL Element

addProgessListener
canGoBack

This read-only property is true if there is a page to go back to in the session history and the Back button should be enabled.

canGoForward

This read-only property is true if there is a page to go forward to in the session history and the Forward button should be enabled.

contentDocument

This read-only property contains the document object in the browser.

contentViewerEdit

This read-only property contains the nsIContentViewerEdit which handles clipboard operations on the document.

contentViewerFile
contentWindow

This read-only property contains the window object for the document.

currentURI

This read-only property contains the currently loaded URL. To change the URL, use the loadURI method.

docShell

This read-only property contains the nsIDocShell object for the document.

documentCharsetInfo

This read-only property contains the nsIDocumentCharsetInfo object for the document which is used to handle which character set should be used to display the document.

goBack ( )

Go back one page in the history.

goForward ( )

Go forward one page in the history.

goHome ( )

Load the user's home page into the browser.

gotoIndex ( index )

Navigate to the page in the history with the given index. Use a positive number to go forward and a negative number to go back.

homePage

This property holds the value of the user's home page setting.

loadURIWithFlags ( uri , flags , referrer )

Load a URL into the document, with the specified load flags and the given referrer. In addition to the flags allowed for the reloadWithFlags methods, the following flags are also valid:

- LOAD_FLAGS_IS_REFRESH: This flag is used when the URL is loaded because of a meta tag refresh or redirect.
- LOAD_FLAGS_IS_LINK: This flag is used when the URL is loaded because a user clicked on a link. The HTTP Referer header is set accordingly.
- LOAD_FLAGS_BYPASS_HISTORY: Do not add the URL to the session history.
- LOAD_FLAGS_REPLACE_HISTORY: Replace the current URL in the session history with a new one. This flag might be used for a redirect.

loadURL
markupDocumentViewer

This read-only property contains the nsIMarkupDocumentViewer which is responsible for drawing the document.

preferences

This read-only property contains an nsIPref object for getting and setting user preferences.

preferences

This read-only property contains an nsIPref object for getting and setting user preferences.

reload ( )

Reloads the document in the browser.

reloadWithFlags ( flags )

Reloads the document in the browser with the given load flags. The flags listed below may be used, which are all constants of the webNavigation property (or the nsIWebNavigation interface). You may combine flags using a or symbol ( | )

- LOAD_FLAGS_NONE: No special flags. The document is loaded normally.
- LOAD_FLAGS_BYPASS_CACHE: Reload the page, ignoring if it is already in the cache. This is the flag used when the reload button is pressed while the Shift key is held down.
- LOAD_FLAGS_BYPASS_PROXY: Reload the page, ignoring the proxy server.
- LOAD_FLAGS_CHARSET_CHANGE: This flag is used if the document needs to be reloaded because the character set changed.

removeProgressListener ( listener )

Remove a progress listener from the browser.

sessionHistory

This read-only property contains the nsISHistory object which holds the session history.

stop ( )

Equivalent to pressing the Stop button, this method stops the currently loading document.

webBrowserFind

This read-only property contains an nsIWebBrowserFind object which can be used to search for text in the document.

webNavigation

This read-only property contains the nsIWebNavigation object for the document. Most of its methods are callable directly on the browser itself, such as goBack and goForward. It also contains the load constants used by reloadWithFlags and loadURIWithFlags.

webProgress

This read-only property contains an nsIWebProgress object which is used to monitor the progress of a document loading.

Copyright (C) 1999 - 2002 XULPlanet.com