Fullscreen API fullscreenEnabled() method
- Previous Page fullscreenElement
- Next Page requestFullscreen()
- Go Up One Level JavaScript Fullscreen API
Definition and Usage
fullscreenEnabled()
The method returns a boolean value indicating whether the document can be viewed in full screen mode.
If full screen mode is available, then fullscreenEnabled()
The method returns true otherwise returns false.
Tip:Please use element.requestFullscreen() method View the element in full screen mode.
Tip:Please use element.exitFullscreen() method Exit full screen mode.
Example
Example 1
Display <video> elements in full screen mode:
/* Get the element you want to display in full screen */ var elem = document.getElementById("myvideo"); /* Function to open full screen mode */ function openFullscreen() { /* Display the element in full screen if full screen mode is available */ if (document.fullscreenEnabled) { /* Display the element in full screen */ elem.requestFullscreen(); } }
Example 2
Use prefixes for cross-browser code:
/* Do something if full screen mode is available */ if ( document.fullscreenEnabled || /* Standard syntax */ document.webkitFullscreenEnabled || /* Safari */ document.msFullscreenEnabled/* IE11 */ ) { ... }
Syntax
document.fullscreenEnabled()
Parameters
None.
Technical Details
Return value: |
A boolean value indicating whether the document can be viewed in full screen mode:
|
---|
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) |
12.0 11.0 (ms) |
64.0 47.0 (moz) |
6.0 (webkit) | 58.0 15.0 (webkit) |
- Previous Page fullscreenElement
- Next Page requestFullscreen()
- Go Up One Level JavaScript Fullscreen API