Check if the user is browsing using mobile

I am building a website on wordpress, the theme I’m using support the desktop and mobile. So the website change based on what the user is using. Anyway, I am trying to determined if the user is using mobile when browsing the website, based on what I have search so far,

echo $_SERVER['HTTP_USER_AGENT'];

This determined the information of something I’m not sure of. When I opened the header.php of my theme file. I did tried to removed these lines, and browse the website on mobile, the website did not appear as a mobile, it appear a FULL VIEW WEBSITE just like on a desktop, and that is the output I’m trying to work on.

 <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />

The problem now is how can I determine if the user is on mobile or not? Any idea on this?

Read more here: Check if the user is browsing using mobile

Leave a Reply

Your email address will not be published. Required fields are marked *