Phaser API Documentation

  Version: 
lockOrientation(orientation)

Description:

Attempts to lock the orientation of the web browser using the Screen Orientation API.

This API is only available on modern mobile browsers. See https://developer.mozilla.org/en-US/docs/Web/API/Screen/lockOrientation for details.

Parameters:

name type description
orientation string

The orientation you'd like to lock the browser in. Should be an API string such as 'landscape', 'landscape-primary', 'portrait', etc.

Returns:
Description:

true if the orientation was successfully locked, otherwise false.

Type:
  • boolean
Since: 3.16.0