I don't if this ever happened to you or not before, but one time I was working on a project and I wanted to know whether my user was accessing the site from a mobile device or a desktop.
I know you can do this with a help of PHP class in your code and I have done that in the past. However, for some apparent reason I couldn't find that file.
I came across apimk, which allowed me to get the mobile information rather than me installing anything on my server.
Another neat feature about this is that all the work is being done on your client's side rather than on your server.
For example, if you get 100,000 visitors daily, then your server is doing a lot of the heavy lifting. However, if you make this call from the client's side, you don't have to worry about your server working as hard.
How To Make The API Call
You can just hop onto apimk - detecting mobile device with jquery
For the most part this is very self-explanatory and it is easy to use.
You would include your jquery at the top of your page, as you would normally do it, then just the following code to make the call:
$.getJSON("https://apimk.com/ismobile?callback=json", function(data, status)
var d = '';
d += 'Status = '+data['Status'];
d += 'Mobile = '+data['Mobile'];
d += 'Browser = '+data['Browser'];
d += 'BrowserVersionNum = '+data['BrowserVersionNum'];
d += 'Platform = '+data['Platform'];
d += 'OS = '+data['OS'];
After you make the API call, you will get the data back in json format, which is probably the most preferable format because it is the most reliable and easy to use.
Result Back In Json Format
Then you could parse through the different kind of data set points.
Check the “Status” data set point to see whether it is “success” or “fail”. If its success, then you can continue parsing the data.
Next, check for “Mobile”, this will be either “yes or no”. That's all it's going to tell you is whether this particular device is accessing it from mobile or not.
You can also get other key information like browser, browser version number, whether the person is accessing it from Windows or whatever platform they're accessing it from.