Construct 3 icon

Construct 3

Documentation

Platform info

Published 12 Nov, 2018
1,021 words
~4-7 mins

The Platform info object returns information about the system, device and browser.

Platform info conditions

Is Cordova export

True when running after a Cordova-based export. Cordova is used to export Android and iOS apps, and implies that the platform is mobile and the OS is either Android or iOS.

Is NW.js export

True when running after an NW.js export.

Is web export

True when running after a web-based export. This is also true in preview mode, so that any features based on these export conditions will act as if it's in a web-based export in preview mode.

Is Windows UWP export

True when running after a Windows UWP export. The Universal Windows Platform (UWP) is used for apps in the Microsoft Store and publishing to Xbox One.

On network change

Triggered when the network connection changes, e.g. when moving from a Wifi network to a cellular data network. The network-related expressions will update in this trigger to reflect values for the new network.

Is on Android

Is on Chrome OS

Is on iOS

Is on Linux

Is on macOS

Is on Windows

These conditions check which operating system (OS) the project is currently running on. For example in Chrome on Windows, Is on Windows will be true; in an Android app, Is on Android will be true; and so on. Note these conditions are not exhaustive: there may be platforms where none of these six conditions are true.

Is on mobile

Test if the current operating system is classed as mobile, i.e. a phone or tablet. The detection may not always be accurate, but should always be true on iOS and Android, and false on Windows, macOS, Linux and Chrome OS.

Platform info actions

The Platform info object does not have any actions.

Platform info expressions

DeviceMemory

Return the approximate amount of device memory (RAM) in gigabytes. For privacy reasons some platforms will round the result, so it may not match the exact amount installed on the system. Additionally this value is not available on some browsers or platforms, in which case it will return 0.

HardwareConcurrency

Return the number of hardware threads supported by the CPU. This is normally at least the number of CPU cores. Many modern CPUs support multiple hardware threads on a single CPU (e.g. Hyper-threading), and a common case is for each CPU to support two hardware threads, so this is often double the number of CPU cores. For privacy reasons some platforms will round the result, so it may not match the exact number of hardware threads/CPU cores available on the system. If the value is not available, it will return 0. However almost all consumer devices have at least two CPU cores.

CanvasCssWidth

CanvasCssHeight

Return the size of the main display canvas in CSS pixels. This does not correspond exactly to device (physical display) pixels, but is the appropriate size from a web design perspective in px units.

CanvasDeviceWidth

CanvasDeviceHeight

Return the size of the main display canvas in device (physical display) pixels. Unlike the CSS size, this size reflects the number of actual pixels used in the display.

DevicePixelRatio

Return the number of device (physical display) pixels per CSS pixel. For example a high-DPI display may have a device pixel ratio of 2, meaning there are two device pixels per CSS pixel. This value also reflects the browser zoom level, which works by adjusting the device pixel ratio. The concept of the device pixel ratio also allows web pages using px units to appear the same size on higher density displays where physical pixels are much smaller.

Renderer

Return a string indicating the graphics rendering technology in use. This can be either "webgl1" or "webgl2". It can also have a -software suffix if a "major performance caveat" is detected, which is a WebGL flag that normally indicates slower software rendering, typically due to unreliable GPU drivers. For example, software-rendered WebGL 1 support would return "webgl1-software".

RendererDetail

Return a string describing system-specific detail about the graphics hardware in use. This typically describes the GPU manufacturer and model name, and sometimes some hardware capabilities.

ScreenWidth

ScreenHeight

Get the size of the current display screen. Note this often includes areas not available to applications, such as a desktop taskbar, or mobile status bar.

WindowInnerWidth

WindowInnerHeight

Get the inner size of the current window. This is the size of the window content area that is available to the application.

WindowOuterWidth

WindowOuterHeight

Get the outer size of the current window. This includes the window browser, caption, browser address bar etc. which is not generally available to the application.

ConnectionEffectiveType

Return a string rating the effective type of the connection based on the comparable cellular data connection generation, e.g. "2g", "3g", "4g".

ConnectionRTT

Return the estimated round-trip time (latency) of the connection in milliseconds. This is the time it takes for a network message to be sent to the remote host and a reply to be received back.

ConnectionType

The type of network connection technology in use, e.g. "cellular", "wifi" or "ethernet". If the connection type cannot be detected or the platform does not support this feature, returns "unknown".

Downlink

The estimated effective download bandwidth in megabits per second. Returns 0 if unable to detect.

DownlinkMax

The maximum downlink speed in megabits per second of the underlying connection technology. This is normally the theoretical maximum the current network technology's specification allows, for example 4G cellular allows a higher maximum speed than 3G under ideal signal conditions; however the actual available bandwidth will depend on other factors like signal quality and other parts of the network. Returns 0 if unable to detect.