Jump to content

Detect a mobile device


Go to solution Solved by bfarber,

Recommended Posts

I know there's a way to do this, because I distinctly remember seeing a method named something like IsMobile in one of the files while I was creating my site integration several months back. But I can't for the life of me remember where I saw it and I can't find it anywhere now having checked in the places you'd expect, such as Sessions, Members and Request.

Does anyone know where the code for this is so I can look at it?

Link to comment
Share on other sites

  • Solution

There's no way to do this in PHP with stock code. Your options are

1. You can reference \IPS\Session::i()->userAgent and based on the browser or platform property, determine yourself if you consider it a mobile request.

2. You can use javascript and check ips.utils.responsive.currentIs('phone') which is determined based on responsive breakpoints rather than the platform.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...