Fullscreen API fullscreenElement property
- Previous Page exitFullscreen()
- Next Page fullscreenEnabled()
- Go Up One Level JavaScript Fullscreen API
Definition and Usage
fullscreenElement
The property returns the current element displayed in full-screen mode, or null if not in full-screen mode.
Tip:Use element.requestFullscreen() method View the element in full-screen mode.
Tip:Use element.exitFullscreen() method Exit full-screen mode.
Example
Example 1
Get the element currently in full-screen mode:
var elem = document.fullscreenElement;
Example 2
Use prefixes for cross-browser code:
if ( document.fullscreenElement || /* Standard syntax */ document.webkitFullscreenElement || /* Safari and Opera syntax */ document.msFullscreenElement /* IE11 syntax */ ) { ... }
Syntax
document.fullscreenElement
Technical Details
Return Value: | Returns the element currently in full-screen mode, or null if full-screen mode is not available. |
---|
Browser Support
The numbers in the table indicate the first browser version that fully supports this method.
Note:Some browsers require specific prefixes (see parentheses):
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
71.0 45.0 (webkit) |
79.0 11.0 (ms) |
64.0 47.0 (moz) |
5.1 (webkit) | 40.0 (webkit) |
- Previous Page exitFullscreen()
- Next Page fullscreenEnabled()
- Go Up One Level JavaScript Fullscreen API