Fullscreen API fullscreenElement
Example
Get the element that is currently in fullscreen mode:
var elem = document.fullscreenElement;
Definition and Usage
The fullscreenElement property returns the current element that is displayed in fullscreen mode, or null when not in fullscreen.
Tip: Use the element.requestFullscreen() method to view an element in fullscreen mode.
Tip: Use the element.exitFullscreen() method to cancel fullscreen mode.
Browser Support
The numbers in the table specify the first browser version that fully supports the property. Note: Some browsers require a specific prefix (see parentheses):
Property | |||||
---|---|---|---|---|---|
fullscreenElement | 71.0 45.0 (webkit) |
79.0 11.0 (ms) |
64.0 47.0 (moz) |
5.1 (webkit) | 40.0 (webkit) |
Example
Using 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 that is currently in fullscreen mode, or null if fullscreen mode is not available |
---|