0

What the most reliable way to determine whether a user visited a page from a mobile phone using JS?

I need somehow determine whether page rendering happens on phone screen or not. If it's happening on phone's screen I need to show different UI controls.

SuperManEver
  • 2,263
  • 6
  • 28
  • 36
  • Possible duplicate of [How to check if the web page is visited by a phone browser or a PC browser?](https://stackoverflow.com/questions/11699555/how-to-check-if-the-web-page-is-visited-by-a-phone-browser-or-a-pc-browser) – Sudhir Ojha Feb 25 '19 at 10:07
  • Common practice is to use the user agent – Jonathan Muller Feb 25 '19 at 10:08

1 Answers1

0

You can use user agent and parse it to find out whether it's mobile or not OR you can go with CSS and make use of media queries

Sebastian Kaczmarek
  • 8,120
  • 4
  • 20
  • 38