Using the Browser API

  • Tags
  • Files

The HTML Browser API is an extension of the HTML iframe element that allows web apps to implement browsers or browser-like applications. This entails two major aspects:

  • Make the iframe 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. Optionally, the notion of that the embedded is an Open Web App can be expressed as well.
  • An API to manipulate and listen for changes of the embedded content's state.

In addition to that, it's also possible to express the notion that the embedded content is an Open Web App. In that case the content is loaded within the appropriate app context (such as permissions).

Usage

An iframe is turned into a browser frame by setting the mozbrowser attribute:

<iframe src="/old?u=https%3A%2F%2Fdeveloper.mozilla.org%2Fen-US%2Fdocs%2FDOM%2F...&y=1999" mozbrowser>

WRITEME

Permissions

WRITEME

Properties

mozapp
xxx
mozbrowser
xxx
remote
xxx

Methods

setVisible(visible)
xxx
goBack()
xxx
goForward()
xxx
getScreenshot()
xxx. Returns a DOMRequest.
getCanGoBack()
xxx. Returns a DOMRequest.
getCanGoForward()
xxx. Returns a DOMRequest.

Events

mozbrowserlocationchange
xxx
mozbrowserloadstart
xxx
mozbrowserloadend
xxx
mozbrowsertitlechange
xxx
mozbrowsericonchange
xxx
mozbrowserclose
xxx
mozbrowsersecuritychange
xxx
mozbrowsererror
xxx

Examples

xxx

Contributors to this page: philikon
Last updated by: philikon,
Last reviewed by: philikon,