HTMLIFrameElement.addNextPaintListener()
HTMLIFrameElement.clearMatch()
HTMLIFrameElement.download()
HTMLIFrameElement.executeScript()
HTMLIFrameElement.findAll()
HTMLIFrameElement.findNext()
HTMLIFrameElement.getActive()
HTMLIFrameElement.getCanGoBack()
HTMLIFrameElement.getCanGoForward()
HTMLIFrameElement.getContentDimensions()
HTMLIFrameElement.getMainfest()
HTMLIFrameElement.getMuted()
HTMLIFrameElement.getScreenshot()
HTMLIFrameElement.getStructuredData()
HTMLIFrameElement.goBack()
HTMLIFrameElement.goForward()
HTMLIFrameElement.getVisible()
HTMLIFrameElement.getVolume()
HTMLIFrameElement.mute()
HTMLIFrameElement.purgeHistory()
HTMLIFrameElement.reload()
HTMLIFrameElement.removeNextPaintListener()
HTMLIFrameElement.sendMouseEvent()
HTMLIFrameElement.sendTouchEvent()
HTMLIFrameElement.setActive()
HTMLIFrameElement.setInputMethodActive()
HTMLIFrameElement.setNFCFocus()
HTMLIFrameElement.setVisible()
HTMLIFrameElement.setVolume()
HTMLIFrameElement.stop()
HTMLIFrameElement.unmute()
HTMLIFrameElement.zoom()
mozbrowseractivitydone
mozbrowserasyncscroll
mozbrowseraudioplaybackchange
mozbrowsercaretstatechanged
mozbrowserclose
mozbrowsercontextmenu
mozbrowserdocumentfirstpaint
mozbrowsererror
mozbrowserfindchange
mozbrowserfirstpaint
mozbrowsericonchange
mozbrowserloadend
mozbrowserloadstart
mozbrowserlocationchange
mozbrowsermanifestchange
mozbrowsermetachange
mozbrowseropensearch
mozbrowseropentab
mozbrowseropenwindow
mozbrowserresize
mozbrowserscroll
mozbrowserscrollareachanged
mozbrowserscrollviewchange
mozbrowsersecuritychange
mozbrowserselectionstatechanged
mozbrowsershowmodalprompt
mozbrowsertitlechange
mozbrowserusernameandpasswordrequired
mozbrowservisibilitychange
Non-standard
This feature is non-standard and is not on a standards track. Do not use it on production sites facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future.
See bug 1318532 for exposing this API to WebExtensions in Firefox.
The HTML Browser API is an extension of the HTML <iframe>
element that allows web apps to implement browsers or browser-like applications. It currently works in (privileged) chrome code on Firefox desktop (version 47 and above).
The Browser API consists of two major parts:
<iframe>
attributes: By adding a mozbrowser
attribute to the <iframe>
element we can make it appear like a top-level browser window to the embedded content. This means that window.top
, window.parent
, window.frameElement
, etc. should not reflect the frame hierarchy.HTMLIFrameElement
interface.To support the requirement of a browser <iframe>
, the HTMLIFrameElement
DOM interface has been extended with new methods that give the <iframe>
some super powers.
The following navigation methods allow navigation through the browsing history of the <iframe>
. They are necessary to be able to implement back, forward, stop, and reload buttons.
HTMLIFrameElement.reload()
<iframe>
element content.HTMLIFrameElement.stop()
<iframe>
's content loading.HTMLIFrameElement.getCanGoBack()
HTMLIFrameElement.goBack()
<iframe>
for the previous location in its browsing history.HTMLIFrameElement.getCanGoForward()
HTMLIFrameElement.goForward()
<iframe>
for the next location in its browsing history.The next set of methods manage the resources used by a browser <iframe>
. These are especially useful for implementing tabbed browser application.
HTMLIFrameElement.setVisible()
<iframe>
. This can influence resource allocation and some function usage such as requestAnimationFrame
.HTMLIFrameElement.getVisible()
<iframe>
.HTMLIFrameElement.setActive()
<iframe>
as the active frame, which has an effect on how it is prioritized by the process manager.HTMLIFrameElement.getActive()
<iframe>
is the currently active frame.The following methods allow direct control of sound in the browser element.
HTMLIFrameElement.getVolume()
<iframe>
.HTMLIFrameElement.setVolume()
<iframe>
.HTMLIFrameElement.mute()
<iframe>
.HTMLIFrameElement.unmute()
<iframe>
.HTMLIFrameElement.getMuted()
<iframe>
is currently muted.In order to manage the browser <iframe>
's content, many new events were added (see below). The following methods are used to deal with those events:
<iframe>
gains support for the methods of the EventTarget
interfaceaddEventListener()
, removeEventListener()
, and dispatchEvent()
.HTMLIFrameElement.sendMouseEvent()
MouseEvent
to the <iframe>
's content.Last, there are some utility methods, useful for apps that host a browser <iframe>
.
HTMLIFrameElement.getStructuredData()
<iframe>
and returns it as JSON.In Firefox 65, several of the Mozilla Browser API methods were removed in an effort to cut down on DOMRequest
usage in the browser, and remove the parts of the Browser API that are no longer needed (it is used only by the Firefox DevTools at this point). See bug 1503070 for more details.
The methods removed in Firefox 65 are:
HTMLIFrameElement.addNextPaintListener()
MozAfterPaint
event in the browser <iframe>
.HTMLIFrameElement.clearMatch()
findAll()
or findNext()
.HTMLIFrameElement.download()
HTMLIFrameElement.executeScript()
<iframe>
.HTMLIFrameElement.findAll()
<iframe>
's content; if found, the first instance of the string relative to the caret position will be highlighted.HTMLIFrameElement.findNext()
findAll()
search has been carried out.HTMLIFrameElement.getContentDimensions()
HTMLIFrameElement.getManifest()
<iframe>
and returns it as JSON.HTMLIFrameElement.getScreenshot()
<iframe>
's content. This is particularly useful to get thumbnails of tabs in a tabbed browser app.HTMLIFrameElement.purgeHistory()
<iframe>
.HTMLIFrameElement.sendTouchEvent()
TouchEvent
to the <iframe>
's content. Note that this method is available for touch enabled devices only.HTMLIFrameElement.removeNextPaintListener()
addNextPaintListener()
.HTMLIFrameElement.zoom()
<iframe>
's content. This is particularly useful for zooming in/out on non-touch-enabled devices.In order to allow an application to manage the browser <iframe>
, the application can listen for new events about what's happening within the browser <iframe>
. The following new events can be listened for:
<iframe>
triggers a web activity, and that web activity's message is consumed by the receiving app.<iframe>
content scrolls (the APCZ version.) See also mozbrowserscroll
. Note that this is obsolete.<iframe>
content.<iframe>
content changes.window.close()
is called within a browser <iframe>
.<iframe>
tries to open a context menu. This allows handling of the <menuitem>
element available within the browser <iframe>
's content.<iframe>
.<iframe>
.<iframe>
content (see HTMLIFrameElement search methods.)<iframe>
paints content for the first time (this doesn't include the initial paint from about:blank.)<link rel="icon">
or <link rel="apple-touch-icon">
) is available in the browser <iframe>
's content.<iframe>
has finished loading all its assets.<iframe>
starts to load a new page.<iframe>
's location changes.<iframe>
with an open web app embedded in it.<meta>
elelment is added to, removed from or changed in the browser <iframe>
's content.window.open()
is called within a browser <iframe>
.<iframe>
as a result of the user issuing a command to open a link target in a new tab (for example ctrl/cmd + click.)<iframe>
's window size has changed.<iframe>
content scrolls.<iframe>
changes. This can occur on resize and when the page size changes (while loading for example.)<iframe>
.<iframe>
content changes. Note that this is obsolete, and newer implementations use mozbrowsercaretstatechanged
instead.alert()
, confirm()
, or prompt()
are called within a browser <iframe>
.<iframe>
.<iframe>
changes, for example due to a call to setVisible()
.This API isn't part of any official specification.