Detect Mobile Browsers

I am using this code to launch a popup form for people to contact us

<a id="pinfo" class="ajax pullup cboxElement" href="#contact-form">
      Enquiries
    </a>

However this popup form doesn’t behave nicely on mobile browsers.

I was wondering if I could use some PHP code to detect mobile browsers and point to an e-mail address link instead of the popup form.

many thanks
Andy

There is no PHP to accurately detect mobile browsers because the PHP runs on the server before anything is even sent to the device.

JavaScript can detect mobile devices by testing the screen size.

Thanks Stephen,

So i suppose i can use javascript to change: href=“#contact-form” to href="mailto:example@domain.com"

?

Take a look at this: https://deviceatlas.com/

I have used this in the past with great success. It works pretty well.

Else you could write you own one in PHP that checks the user-agent header to decide based on that