A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://developer.mozilla.org/en-US/docs/Web/API/Document/exitFullscreen below:

Document: exitFullscreen() method - Web APIs

Document: exitFullscreen() method

Limited availability

The Document method exitFullscreen() requests that the element on this document which is currently being presented in fullscreen mode be taken out of fullscreen mode, restoring the previous state of the screen. This usually reverses the effects of a previous call to Element.requestFullscreen().

Syntax Parameters

None.

Return value

A Promise which is resolved once the user agent has finished exiting fullscreen mode. If an error occurs while attempting to exit fullscreen mode, the catch() handler for the promise is called.

Examples

This example causes the current document to toggle in and out of a fullscreen presentation whenever the mouse button is clicked within it.

document.onclick = (event) => {
  if (document.fullscreenElement) {
    document
      .exitFullscreen()
      .then(() => console.log("Document Exited from Full screen mode"))
      .catch((err) => console.error(err));
  } else {
    document.documentElement.requestFullscreen();
  }
};

Note: For a more complete example, see the Element.requestFullscreen() examples.

Specifications Browser compatibility See also

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.3