os_browser

This variable holds a different constant depending on the browser the game is currently being run in.

Syntax:

os_browser


Returns: Constant


Description

This variable holds one of various constant GameMaker Studio 2 has to tell you which browser you are currently running the game in (if any). The following constants can be returned:

Constant Description
browser_not_a_browser Game is not being played in a browser
browser_unknown Unknown browser
browser_ie Internet Explorer
browser_ie_mobile Internet Explorer on a mobile device
browser_firefox Mozilla Firefox
browser_chrome Google Chrome
browser_safari Safari
browser_safari_mobile Safari on a mobile device
browser_opera Opera
browser_tizen Tizen mobile device browser
browser_windows_store Windows 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.