Lightweight PHP Class for Detecting Mobile Devices

Today I came across a fantastic, lightweight PHP class for detecting mobile devices. It’s called Mobile Detect, and you can download it here: http://mobiledetect.net/

The use case from today involved swapping in a lighter-weight slider element on mobile, while allowing a heavier-weight slider to render on desktop.

Media queries and “display: none;” aren’t sufficient for this, because you’d wind up loading two sliders (whether on desktop or mobile).

Since the heavier-weight video slider in my client’s case is 40MB+, this would be a huge impact on data for mobile users and completely unacceptable.

Mobile Detect also allows you to target tablets, and is currently in beta for detecting browsers (i.e., iOS, Chrome, etc.).

Hats off to Şerban GhiţăNick Ilyin, and Victor Stanciu for developing and authoring this easy-to-use PHP class.

Share This Article:

Liked this article? Sign up for more.

Steve believes your greatest creation happens when you combine art and science. Join his 10K+ followers on social media and email today.

100% Privacy. No spam. Unsubscribe anytime.

Related Posts

Leave a Reply