I volontari di MDN non hanno ancora tradotto questo articolo in Italiano. Unisciti a noi e traducilo tu stesso.
Puoi anche consultare l’articolo in English (US).
The Document
method 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()
.
The exception is if another element was already in full-screen mode when the current element was placed into full-screen mode using requestFullscreen()
. In that case, the previous full-screen element is restored to full-screen status instead. In essence, a stack of full-screen elements is maintained.
Syntax
exitPromise = document.exitFullscreen();
Parameters
None.
Return value
A Promise
which is resolved once the user agent 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.
Example
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() } else { document.documentElement.requestFullscreen() } };
Note: For a more complete example, see the Example in Element.requestFullscreen().
Specifications
Specification | Status | Comment |
---|---|---|
Fullscreen API The definition of 'Document.exitFullscreen()' in that specification. |
Living Standard | Initial definition |
Browser compatibility
Desktop | Mobile | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Basic support | Chrome
Full support
45
| Edge Full support 12 | Firefox
Full support
64
| IE
Full support
11
| Opera
Full support
15
| Safari
Full support
5.1
| WebView Android
Full support
45
| Chrome Android
Full support
45
| Edge Mobile ? | Firefox Android
Full support
64
| Opera Android ? | Safari iOS No support No | Samsung Internet Android ? |
Returns a Promise | Chrome Full support 71 | Edge No support No | Firefox Full support 64 | IE No support No | Opera ? | Safari ? | WebView Android Full support 71 | Chrome Android Full support 71 | Edge Mobile No support No | Firefox Android Full support 64 | Opera Android ? | Safari iOS ? | Samsung Internet Android ? |
Legend
- Full support
- Full support
- No support
- No support
- Compatibility unknown
- Compatibility unknown
- User must explicitly enable this feature.
- User must explicitly enable this feature.
- Uses a non-standard name.
- Uses a non-standard name.
- Requires a vendor prefix or different name for use.
- Requires a vendor prefix or different name for use.