mozilla

HTMLIFrameElement.getScreenshot()

Non-standard
This feature is not on a current W3C standards track, but it is supported on the Firefox OS platform. Although implementations may change in the future and it is not supported widely across browsers, it is suitable for use in code dedicated to Firefox OS apps.

This API is available on Firefox OS for privileged or certified applications only.

Summary

The getScreenshot() method lets you request a screenshot of an <iframe>, scaled to fit within a specified maximum width and height; the image may be cropped if necessary but will not be squished vertically or horizontally..

Syntax

var instanceOfDOMRequest = instanceOfHTMLIframeElement.getScreenshot(maxWidth, maxHeight, mimeType);

Parameters

maxWidth
A number representing the maximum width of the screenshot in CSS pixels.
maxHeight
A number representing the maximum height of the screenshot in CSS pixels.
mimeType
MIME type specifying the format of the image to be returned; the default is image/jpeg. Use image/png to capture the alpha channel of the rendering result by returning a PNG-format image. This lets you get the transparent background of the <iframe>.

Return

Returns a DOMRequest object you can use to handle the request's success or error. If the request is successful, the request's result will be a Blob object representing the new screenshot.

Note:  Beginning with Firefox OS 1.4, the dimensions of the screenshot are in actual device pixels. See bug 959066 for details.

Specification

Not part of any specification.

See also

Document Tags and Contributors

Contributors to this page: Sheppy, Jeremie, teoli, timdream, kscarfone, ajaybhat
Last updated by: teoli,
Hide Sidebar