A XUL <browser>
element represents 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.
Are you here looking for information about the Firefox web browser, or because you'd like to download the latest version of Firefox?
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.
<!-- shows Mozilla homepage inside a groupbox --> <groupbox flex="1"> <caption label="Mozilla homepage"/> <browser type="content" src="http://www.mozilla.org" flex="1"/> </groupbox>
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
disableglobalhistory
disablesecurity
true
to disable the security UI for this browser. Omit this attribute off to enable it.droppedLinkHandler
This function is called when links are dropped to the browser element, with the following arguments.
droppedLinkHandler(event, uri, name) -- Firefox 51 or older droppedLinkHandler(event, links) -- Firefox 52 or newer
event
-- drop event, or null
if no event is availableuri
-- uri string of the dropped linkname
-- name string of the dropped linklinks
-- array of the dropped items with nsIDroppedLinkItem interfaceremote
showcaret
false
.src
type
browser
. More precisely: The document 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 as making window.top == window (unless the browser
is added to a chrome document), 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.content
content-primary
content-targetable
browser
element in an application, which will use multiple browsers of equal privileges, and is unselected at the moment.chrome
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.0nsIDocumentCharsetInfo
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 / SeaMonkey 2.9).homePage
markupDocumentViewer
nsIMarkupDocumentViewer
nsIMarkupDocumentViewer
which is responsible for drawing the document.messageManager
browser
element.preferences
nsIPrefService
nsIPref
object for getting and setting user 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.addProgressListener( listener )
nsIWebProgressListener
interface.goBack()
goForward()
goHome()
gotoIndex( index )
NOTE: This is the XUL method on <browser> / <tabbrowser>, not the global function in chrome://browser/content/browser.js. Please check which one you're documenting! (This one has no post data parameter, see loadURIWithFlags for a version that does)
loadURI( uri, referrer, charset )
nsIURI
object. To get a string from an nsIURI
, use nsIURI.spec
or nsIURI.asciiSpec
loadURIWithFlags( uri, flags, referrer, charset, postData )
reloadWithFlags
method, 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()
browser
element on which you call this method.reloadWithFlags( flags )
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 )
nsIWebProgressListener
from the browser.stop()
swapDocShells( otherBrowser )
browser
with 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.Note: Both browsers must be either standalone browsers or embedded in a tabbrowser
. You can't mix them.
nsIAccessibleProvider