How to know the platform that runs the game?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By M77mdsD

I want to know the platform that is running my game, but I want to even know that in HTML5. I mean I want to know if this HTML5 is running on a pc or on a phone.

:bust_in_silhouette: Reply From: xAkuma69

similar question that would help:

https://forum.godotengine.org/6374/how-to-get-current-platform-os

:bust_in_silhouette: Reply From: Rodeo

Class OS has a method get_name() which returns a string identifying the current platform. However, it counts HTML5 as a platform, so this won’t work for your use case.

Instead you could use get_model_name(). It returns the model name on Android and iOS, but returns “GenericDevice” on unsupported (i.e. PC) platforms.