Table of contents
- 1. Examples
- 2. Attributes
- 3. Properties
- 4. Methods
- 5. Related
A frame which is expected to contain a view of a Web document. It is similar to an iframe
except that it holds a page history and contains additional methods to manipulate the currently displayed page.
Most of the properties and methods of the browser will 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
- autocompleteenabled , autocompletepopup , autoscroll , disablehistory , disablesecurity , homepage , showcaret , src , type
- Properties
- accessibleType , canGoBack , canGoForward , contentDocument , contentPrincipal , contentTitle , contentViewerEdit , contentViewerFile , contentWindow , currentURI , docShell , documentCharsetInfo , homePage , markupDocumentViewer , messageManager , preferences , securityUI , sessionHistory , webBrowserFind , webNavigation , webProgress
- Methods
- addProgressListener , goBack , goForward , goHome , gotoIndex , loadURI , loadURIWithFlags , reload , reloadWithFlags , removeProgressListener , stop , swapDocShells
Examples

<!-- shows Mozilla homepage inside a groupbox --> <groupbox flex="1"> <caption label="Mozilla homepage"/> <browser type="content" src="http://www.mozilla.org" flex="1"/> </groupbox>
Attributes
Inherited from XUL element
align
, allowevents
, allownegativeassertions
, class
, coalesceduplicatearcs
, collapsed
, container
, containment
, context
,
, datasources
, dir
, empty
, equalsize
, flags
, flex
, height
,
, id
, insertafter
, insertbefore
, left
, maxheight
, maxwidth
,
, minheight
, minwidth
, mousethrough
, noinitialfocus
, observes
, ordinal
, orient
, pack
, persist
, popup
, position
, preference-editable
, querytype
, ref
, removeelement
, sortDirection
, sortResource
, sortResource2
, statustext
, style
, template
, tooltip
, tooltiptext
, top
, uri
, wait-cursor
, width
autocompleteenabled
true to enable autocomplete of fields.
autocompletepopup
id
of a popup
element used to hold autocomplete results for the element.autoscroll
false to disable autoscroll for this browser. If this attribute is set to true or omitted, autoscroll will be enabled or depending on the user preference general.autoScroll.
disablehistory
Obsolete since Gecko 2.0
false, an arrow button will appear on the end of the textbox which will open a dropdown menu of all available results. The default value is true, hiding the dropdown button. This attribute only works correctly in SeaMonkey 1.x; for Thunderbird and SeaMonkey 2.0 you should also set the enablehistory
attribute; as of Gecko 2.0 this attribute is completely superseded by it.disablesecurity
true to disable the security UI for this browser. Omit this attribute off to enable it. showcaret
false.
src
type
. More precisely: The documented loaded into a chrome window is always of chrome type. Subdocuments of chrome documents are of chrome type unless the container element (one of iframe, browser or editor) has one of the special type attribute values (the common ones are content, content-targetable and content-primary) indicating that the subdocument is of content type. This boundary has a number of special effects such has making window.top == window and preventing documents from inheriting the principal of the parent document. The type attribute on all frames in content documents is ignored; subdocuments of content documents are always content documents.browser
contentcontent-primarycontent-targetable element in an application that will use multiple browsers of equal privileges and is unselected at the moment.browser
chrome
Properties
Inherited Properties
align
,
attributes, allowEvents
,
baseURI, boxObject
, builder
,
childElementCount,
childNodes,
children, className
,
clientHeight,
clientLeft,
clientTop,
clientWidth, collapsed
, contextMenu
, controllers
, database
, datasources
, dir
,
firstChild,
firstElementChild, flex
, height
, hidden
, id
,
lastChild,
lastElementChild, left
,
localName, maxHeight
, maxWidth
, menu
, minHeight
, minWidth
,
namespaceURI,
nextElementSibling,
nextSibling,
nodeName,
nodeType,
nodeValue, observes
, ordinal
, orient
,
ownerDocument, pack
,
parentNode, persist
,
prefix,
previousElementSibling,
previousSibling, ref
, resource
,
scrollHeight,
scrollLeft,
scrollTop,
scrollWidth, statusText
, style
,
tagName,
textContent, tooltip
, tooltipText
, top
, width
accessibleType
canGoBack
true if there is a page to go back to in the session history and the Back button should be enabled. canGoForward
true if there is a page to go forward to in the session history and the Forward button should be enabled. contentDocument
contentPrincipal
nsIPrincipal
contentTitle
contentViewerEdit
nsIContentViewerEdit
nsIContentViewerEdit
which handles clipboard operations on the document.
contentViewerFile
nsIContentViewerFile
nsIContentViewerFile
interface for the document.
contentWindow
currentURI
nsIURI
loadURI
method.
docShell
nsIDocShell
nsIDocShell
object for the document.
documentCharsetInfo
Obsolete since Gecko 12.0
nsIDocumentCharsetInfo
nsIDocumentCharsetInfo
object for the document which is used to handle which character set should be used to display the document. The properties of the nsIDocumentCharsetInfo
object were merged into the docshell in Gecko 12.0 (Firefox 12.0 / Thunderbird 12.0)
.homePage
markupDocumentViewer
nsIMarkupDocumentViewer
nsIMarkupDocumentViewer
which is responsible for drawing the document.
messageManager
Requires Gecko 2.0
browser
element.preferences
securityUI
nsISecureBrowserUI
sessionHistory
nsISHistory
nsISHistory
object which holds the session history.
webBrowserFind
nsIWebBrowserFind
nsIWebBrowserFind
object which can be used to search for text in the document.
webProgress
nsIWebProgress
nsIWebProgress
object which is used to monitor the progress of a document loading.
Methods
addProgressListener( listener )- Return type: no return value
- Add a progress listener to the browser which will monitor loaded documents. The progress listener should implement the
nsIWebProgressListenerinterface.
-
goBack() - Return type: no return value
- Go back one page in the history.
-
goForward() - Return type: no return value
- Go forward one page in the history.
-
goHome() - Return type: no return value
- Load the user's home page into the browser.
-
gotoIndex( index ) - Return type: no return value
- 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.
loadURI( uri, referrer, charset )- Return type: no return value
- Load a URL into the document, with the given referrer and character set.
- The first argument should be a string, not a
nsIURIobject. To get a string from annsIURI, usensIURI.specornsIURI.asciiSpec
loadURIWithFlags( uri, flags, referrer, charset, postData )- Return type: no return value
- Load a URL into the document, with the specified load flags, the given referrer, character set, and POST data. In addition to the flags allowed for the
reloadWithFlagsmethod, 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.
(See nsIWebNavigation.loadURI()
for details on the referrer and postData parameters.)
reload()- Return type: no return value
- Reloads the document in the
browserelement on which you call this method.
reloadWithFlags( flags )- Return type: no return value
- Reloads the document in the browser with the given load flags. The flags listed below may be used, which are all constants of the
webNavigationproperty (or thensIWebNavigationinterface). 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 )- Return type: no return value
- Remove a
nsIWebProgressListenerfrom the browser.
-
stop() - Return type: no return value
- Equivalent to pressing the Stop button, this method stops the currently loading document.
swapDocShells( otherBrowser )- Return type: no return value
- Swaps the content, history and current state of this
browserwith another browser. During the swap, pagehide and pageshow events are fired on both browsers. This method can be used to move browser between windows or tear off a browser into a new window.
Related
- Interfaces
nsIAccessibleProvider
Mozilla Developer Network