For multimedia players, presentation tools, dashboards, and mobile web games, engaging the user requires removing browser chrome (toolbars, address bars) and managing display layout. The Fullscreen API and Screen Orientation API provide programmatic control over the viewport display mode.
The Fullscreen API allows any HTML element—or the entire document—to expand to fill the entire physical screen.
:fullscreen Pseudo-Class:Mobile web applications often require locking the display to landscape (for video/gaming) or portrait:
To prevent malicious websites from hijacking user screens, requestFullscreen() strictly requires a transient user gesture (e.g. click or key down). Calling element.requestFullscreen() automatically inside setTimeout() or on page load throws a TypeError: Permissions check failed.
Continue learning with hands-on practice, examples, and exercises in the upcoming topic.
| Previous Lesson | Next Lesson |
|---|---|
| Geolocation, Clipboard & Device APIs | Web Audio & MediaStream APIs Basics |
Test your understanding of this lesson with 5 questions. Each question has one correct answer.
Practice in live mentor-led sessions with real projects, mock tests, and verifiable certification at MSK Institute.