警告 : Removed in Firefox 65.
getScreenshot()
方法在
HTMLIFrameElement
lets you request a screenshot of a content
<iframe>
, scaled to fit within a specified maximum width and height. The image will be cropped if necessary but will not be distorted vertically or horizontally.
注意
:
getScreenshot()
waits for the event loop to go idle before it takes the screenshot. It won't wait more than 2000ms (this delay is defined by the Gecko
dom.browserElement.maxScreenshotDelayMS
preference).
var instanceOfDOMRequest = instanceOfHTMLIframeElement.getScreenshot(maxWidth, maxHeight, mimeType);
A
DOMRequest
for handling the screenshot request. Its
request.onsuccess
handler handles the success case (the screenshot is contained in
request.result
作为
Blob
object), and its
request.onerror
handler handles the failure case.
maxWidth
A number representing the maximum width of the screenshot in device pixels.
maxHeight
A number representing the maximum height of the screenshot in device pixels.
mimeType
可选
image/jpeg
。使用
image/png
to capture the alpha channel of the rendered result by returning a PNG-format image. This lets you get a transparent background for the content
<iframe>
.
var browser = document.querySelector('iframe'); var request = browser.getScreenshot(100, 100); request.onsuccess = function() { var blob = request.result; var url = URL.createObjectURL(blob); }
Not part of any specification.
Supported since Firefox 47, in chrome code only. Removed completely in Firefox 65.
Unlikely ever to be supported in other browsers.
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