how to detect whether request is coming from browser or smartphone? [duplicate]
Asked Answered
S

2

-1

I am having a web application , which works fine . now there is a particular page which gets bulky when i access the application from smartphone browser , so I wanted a situation like

if(request comes from computer browser client )
forward to bulky page in web application
else
if (request comes from smartphone )
forward to some other light page .

please put your suggestion how can i achieve this

Servant answered 4/9, 2013 at 20:18 Comment(0)
F
3

Use the user-agent. Every connection to your server carries this header, by convenience and convention. There is no guarantee that a browser will be truthful(such as a spambot reporting itself as Chrome). You can get the user-agent as follows:

request.getHeader("User-Agent");

and then check again known user-agent strings and templates.

Formaldehyde answered 4/9, 2013 at 20:21 Comment(0)
D
1

It's generally done by checking "User-Agent" header of Request

Dermatoplasty answered 4/9, 2013 at 20:21 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.