jenssegers / agent

👮 A PHP desktop/mobile user agent parser with support for Laravel, based on Mobiledetect
https://jenssegers.com
MIT License
4.48k stars 472 forks source link

How to check if Mobile Browser or Mobile app? #204

Closed imfaisii closed 1 year ago

imfaisii commented 1 year ago

I wanna know if there is any way to check if the user agent is from mobile browser or mobile app? I have an application that can submit from mobile app and can also be open in browser. How I know someone has submitted using mobile browser or mobile app?

yuxxeun commented 1 year ago

for this case, you can use device_type property

imfaisii commented 1 year ago

no, that will tell device but will not tell if mobile app or mobile browser

yuxxeun commented 1 year ago

what do u mean about mobile app? Laravel by default is for creating web-app, so from that is a clear that if someone accessing Laravel based-app its mean he's using mobile browser because its not a mobile app.

and that concept also applies to this package, this package made for Laravel which is automatically same and only runs through a web browser.

imfaisii commented 1 year ago

what do u mean about mobile app? Laravel by default is for creating web-app, so from that is a clear that if someone accessing Laravel based-app its mean he's using mobile browser because its not a mobile app.

and that concept also applies to this package, this package made for Laravel which is automatically same and only runs through a web browser.

Laravel can be used as a backend in mobile apps too. I am using the apis in mobile app and auditing a model with user agent.

yuxxeun commented 1 year ago

maybe Laravel itself can running in mobile, but for this package im not yet sure

imfaisii commented 1 year ago

maybe Laravel itself can running in mobile, but for this package im not yet sure

Oh great, thank you for the interest. I figured a way out by adding a custom user-agent in the header of all my mobile requests. For now this is the solution that comes in my mind.