Full screen API

Simple way to make the window full screen.

Press button or press Enter to make this window full screen. Press button, ESC or Enter again to exit full screen.

Vintage car on a field

Source

Javascript:

document.addEventListener("keydown", (e) => {
if (e.key === "Enter") {
toggleFullScreen();
}
}, false);

function toggleFullScreen() {
if (!document.fullscreenElement) {
document.documentElement.requestFullscreen();
} else if (document.exitFullscreen) {
document.exitFullscreen();
}
}