Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
fullscreenChange

fullscreenChange | fullscreenChange event

Fires when an element enters or exits full-screen mode.

Syntax

 

Event handler parameters

This method has no parameters.

Remarks

The event fires once the element is in full-screen mode, so you can get the current state. The following example checks fullscreenElement to see if any elements are in full-screen mode. If the element is in full-screen mode, this returns the element, such as HTMLDivElement. If not, the fullscreenElement property returns null.

As of Microsoft Edge, the experimental "ms" prefix was removed from MSFullscreenChange. The recommended usage is as follows:

IE VersionRecommended Usage
Prior to Internet Explorer 11not implemented
IE11MSFullscreenChange
Microsoft Edge and beyondfullscreenChange

 

For improved compatibility with legacy sites, webkitFullscreenChange is also supported as an alias of fullscreenChange in Microsoft Edge.

Examples

The following example prints a message to the console whether or not an element is displayed in full-screen mode.


document.addEventListener("fullscreenChange", function () {
          if (document.fullscreenElement != null) {
              console.info("Went full screen");
          } else {
              console.info("Exited full screen");              
          }
      });

See also

document
fullscreenError

 

 

Show:
© 2015 Microsoft