// Example: log detected operating system to console on startup
runOnStartup(async runtime =>
{
console.log("The detected OS is: " + runtime.platformInfo.os);
});
Platform info APIs
- isMobile
- A read-only boolean indicating whether Construct detects the current device as "mobile".
- os
- A read-only string with the operating system Construct has detected, which is one of
"windows"
, "macos"
, "linux"
, "chrome-os"
, "android"
, "ios"
or "unknown"
.
- osVersion
- A read-only string with the operating system version Construct has detected, or the string
"(unknown)"
if it failed to identify a version.
- browser
- A read-only string with the browser Construct has detected, which is one of
"chrome"
, "chromium"
, "edge"
, "opera"
, "nwjs"
, "firefox"
, "safari"
or "unknown"
.
- browserVersion
- A read-only string with the browser version Construct has detected, or the string
"(unknown)"
if it failed to identify a version.
- browserEngine
- A read-only string with the browser engine Construct has detected, which is one of
"chromium"
, "gecko"
, "webkit"
, or "unknown"
if failed to identify any.
- exportType
- A read-only string indicating the export option used to export the project, which is one of
"preview"
(when previewing prior to export), "html5"
, "scirra-arcade"
, "cordova-android"
, "cordova-ios"
, "nwjs"
, "windows-webview2"
, "macos-wkwebview"
, "linux-cef"
, "xbox-uwp-webview2"
, "instant-games"
or "playable-ad"
.
- renderer
- A read-only string indicating the graphics rendering technology in use. This can be
"webgl1"
, "webgl2"
or "webgpu"
. It can also have a -software
suffix if a "major performance caveat" is detected, which normally indicates slower software rendering, typically due to unreliable GPU drivers. For example, software-rendered WebGL 1 support would return "webgl1-software"
.
- rendererDetail
- A read-only 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.
- canvasCssWidth
- canvasCssHeight
- Read-only numbers with 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
- Read-only numbers with 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 devicePixelRatio property.