I want to be able to run or not run code depending on which platform I am building for. Some code should only run for the HTML5 platform. How can I find out whether the platform being run is HTML5 inside my gamemaker events?


1 Answer 1


You can check what browser the game is currently being run in with the os_browser constant. If the game is not being run in a browser the constant will be browser_not_a_browser. So to check if it is being run in a browser simply do:

if os_browser != browser_not_a_browser {
     // Being run in a browser

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .