-2

I recently made a javascript game, however, it refuses to work with phones and iPads...

Is there some way to know that whether the user is with a PC or not, so that I can prevent mobile users from trying it?

mkrieger1
  • 19,194
  • 5
  • 54
  • 65
Namrouch
  • 3
  • 2
  • possible duplicate of [Detecting a mobile browser](http://stackoverflow.com/questions/11381673/detecting-a-mobile-browser) – JJJ Jul 05 '15 at 09:13

1 Answers1

-1

You can use media query for the responsive UI and see the below code:

 // For Smartphone
            if (window.innerWidth < 600)
            {
                // TODO-- for the SmartPhone
            }

            // For Tablet
            else if(window.innerWidth > 600 && window.innerWidth < 768)
            {
                //TODO-- for the Tablet.
            }

            // For Desktop
            else if(window.innerWidth > 768)
            {
                //TODO -- for the Desktop.
            }
Gul Ershad
  • 1,743
  • 2
  • 25
  • 32