I’m going to share with you a website that I’ve been using in my projects lately. It’s called apimk.com and on this website they will allow you to make a few api calls and in return they will give you some key information.
For example, 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 and you will see:
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:
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.