Document
方法
exitFullscreen()
requests that the element on this document which is currently being presented in full-screen mode be taken out of full-screen mode, restoring the previous state of the screen.
This usually reverses the effects of a previous call to
Element.requestFullscreen()
.
exitPromise = document.exitFullscreen();
None.
A
Promise
which is resolved once the
用户代理
has finished exiting full-screen mode. If an error occurs while attempting to exit full-screen mode, the
catch()
handler for the promise is called.
This example causes the current document to toggle in and out of a full-screen presentation whenever the mouse button is clicked within it.
document.onclick = function (event) {
if (document.fullscreenElement) {
document.exitFullscreen()
.then(() => console.log("Document Exited form Full screen mode"))
.catch((err) => console.error(err))
} else {
document.documentElement.requestFullscreen();
}
}
注意: For a more complete example, see the 范例 in Element.requestFullscreen() .
| 规范 | 状态 | 注释 |
|---|---|---|
|
全屏 API
The definition of 'Document.exitFullscreen()' in that specification. |
实时标准 | 初始定义 |
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
exitFullscreen
|
Chrome
45
|
Edge 12 |
Firefox
64
|
IE
11
Alternate Name
|
Opera
15
Prefixed
|
Safari
5.1
Prefixed
|
WebView Android
45
|
Chrome Android
45
|
Firefox Android
64
|
Opera Android Yes | Safari iOS No |
Samsung Internet Android
5.0
|
返回
Promise
|
Chrome 71 | Edge 79 | Firefox 64 | IE No | Opera ? | Safari ? | WebView Android 71 | Chrome Android 71 | Firefox Android 64 | Opera Android ? | Safari iOS No | Samsung Internet Android 10.0 |
完整支持
不支持
兼容性未知
用户必须明确启用此特征。
使用非标名称。
要求使用供应商前缀或不同名称。
Element.requestFullscreen()
Document.fullscreenElement
:fullscreen
and
::backdrop
<iframe>
allowfullscreen
属性
Document
alinkColor
all
anchors
applets
bgColor
body
characterSet
childElementCount
children
compatMode
contentType
currentScript
defaultView
designMode
dir
doctype
documentElement
documentURI
documentURIObject
domain
domConfig
嵌入
fgColor
firstElementChild
forms
fullscreen
fullscreenEnabled
head
height
hidden
图像
实现
lastElementChild
lastModified
lastStyleSheetSet
linkColor
链接
location
mozSyntheticDocument
onabort
onafterscriptexecute
onanimationcancel
onanimationend
onanimationiteration
onauxclick
onbeforescriptexecute
onblur
oncancel
oncanplay
oncanplaythrough
onchange
onclick
onclose
oncontextmenu
oncuechange
ondblclick
ondurationchange
onended
onerror
onfocus
onformdata
onfullscreenchange
onfullscreenerror
ongotpointercapture
oninput
oninvalid
onkeydown
onkeypress
onkeyup
onload
onloadeddata
onloadedmetadata
onloadend
onloadstart
onlostpointercapture
onmousedown
onmouseenter
onmouseleave
onmousemove
onmouseout
onmouseover
onmouseup
onoffline
ononline
onpause
onplay
onplaying
onpointercancel
onpointerdown
onpointerenter
onpointerleave
onpointermove
onpointerout
onpointerover
onpointerup
onreset
onresize
onscroll
onselect
onselectionchange
onselectstart
onsubmit
ontouchcancel
ontouchstart
ontransitioncancel
ontransitionend
onvisibilitychange
onwheel
origin
plugins
popupNode
preferredStyleSheetSet
readyState
referrer
rootElement
脚本
scrollingElement
selectedStyleSheetSet
styleSheetSets
timeline
title
tooltipNode
URL
visibilityState
vlinkColor
width
xmlEncoding
xmlVersion
adoptNode()
append()
caretRangeFromPoint()
clear()
close()
createAttribute()
createCDATASection()
createComment()
createDocumentFragment()
createElement()
createElementNS()
createEntityReference()
createEvent()
createExpression()
createExpression()
createNodeIterator()
createNSResolver()
createNSResolver()
createProcessingInstruction()
createRange()
createTextNode()
createTouch()
createTouchList()
createTreeWalker()
enableStyleSheetsForSet()
evaluate()
evaluate()
execCommand()
exitFullscreen()
exitPointerLock()
getAnimations()
getBoxObjectFor()
getElementById()
getElementsByClassName()
getElementsByName()
getElementsByTagName()
getElementsByTagNameNS()
hasFocus()
hasStorageAccess()
importNode()
mozSetImageElement()
open()
prepend()
queryCommandEnabled()
queryCommandSupported()
querySelector()
querySelector()
querySelectorAll()
querySelectorAll()
registerElement()
releaseCapture()
replaceChildren()
requestStorageAccess()
write()
writeln()
animationcancel
animationend
animationiteration
animationstart
copy
cut
DOMContentLoaded
drag
dragend
dragenter
dragexit
dragleave
dragover
dragstart
drop
fullscreenchange
fullscreenerror
gotpointercapture
keydown
keypress
keyup
lostpointercapture
paste
pointercancel
pointerdown
pointerenter
pointerleave
pointerlockchange
pointerlockerror
pointermove
pointerout
pointerover
pointerup
readystatechange
scroll
selectionchange
selectstart
touchcancel
touchend
touchmove
touchstart
transitioncancel
transitionend
transitionrun
transitionstart
visibilitychange
wheel