os_browser

This read-only variable holds one of various constants (listed below) that GameMaker has to tell you which browser you are currently running the game in (if any).

NOTE The GX.games target, even though it runs on a browser, always returns browser_not_a_browser.

 

Syntax:

os_browser

 

Returns:

Browser Type Constant

Browser Type Constant
ConstantDescription
browser_not_a_browserGame is not being played in a browser, or is being played through the GX.games target
browser_unknownUnknown browser
browser_ieInternet Explorer
browser_ie_mobileInternet Explorer on a mobile device
browser_edgeMicrosoft Edge
browser_firefoxMozilla Firefox
browser_chromeGoogle Chrome
browser_safariSafari
browser_safari_mobileSafari on a mobile device
browser_operaOpera
browser_tizenTizen mobile device browser
browser_windows_storeWindows App

 

Example:

if (os_browser == browser_not_a_browser)
{
    global.Config = 0;
}
else
{
    global.Config = 1;
}

The above code checks to see if the game is running in a browser or not and sets a global variable to a value depending on the result of the check.