khleug35 Posted November 30, 2018 Share Posted November 30, 2018 How to detect desktop or mobile before game initialisation?? I using the following code to detect var DetectDevice = /iPhone|iPad|iPod|Android/i.test(navigator.userAgent); if (DetectDevice) { console.log("You are using Mobile"); } else { console.log("You are using Desktop"); } Is there any easy way to detect?? thank you very much Quote Link to comment Share on other sites More sharing options...
enpu Posted November 30, 2018 Share Posted November 30, 2018 You can use game.device object to detect different devices. Type game.device to console to see all different possibilities. if (game.device.mobile) { // Game running on mobile device } khleug35 1 Quote Link to comment Share on other sites More sharing options...
khleug35 Posted November 30, 2018 Author Share Posted November 30, 2018 @enpu Great!!! Thank you very much!! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.