How to detect the device from which WebGL is being opened?

Hello everyone. I am just starting in the world of Unity. I am building my website in WebGL. I would like to know if it is possible to communicate JS with C#. When the JS detects the type of device either Mobile or Desktop then it tells the C# to execute the type of interface to navigate inside the page. The user will move inside the gallery like a FPS game. If the user uses a phone then it should use a touch interface to move inside the scenario and if it is a Desktop user it would use the keyboard. Does anyone know of a tutorial that explains this. Thank you very much

You don’t need JS to detect the runtime platform, just use SystemInfo.deviceMode. Find it in the scripting documentation here.