MoreLesson 212Free preview
Fullscreen Window
This lesson is part of How To · All levels
Summary
The fullscreen API allows a particular page or element to be displayed filling an entire screen without a browser interface. JavaScript calls requestFullscreen() to the element, then exitFullscreen() to exit. Changes in status can be monitored through the event fullscreenchange and the fullscreenElement properties.
Key points
- Call element.requestFullscreen() in response to user action
- Use document.exitFullscreen() to exit the full screen mode
- Check document.fullscreenElement for current status
- RequestFullscreen returns a Promise that may fail, so handle the error
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.