Phaser API Documentation

  Version: 
toggleFullscreen([fullscreenOptions])

Description:

Toggles the fullscreen mode. If already in fullscreen, calling this will cancel it. If not in fullscreen, this will request the browser to enter fullscreen mode.

If the browser does not support this, a FULLSCREEN_UNSUPPORTED event will be emitted.

This method must be called from a user-input gesture, such as pointerdown. You cannot launch games fullscreen without this, as most browsers block it. Games within an iframe will also be blocked from fullscreen unless the iframe has the allowfullscreen attribute.

Parameters:

name type arguments description
fullscreenOptions object <optional>

The FullscreenOptions dictionary is used to provide configuration options when entering full screen.

Since: 3.16.0