I am working in project which are in two version one for pc and other for mobile . for both page are different. For that i want to know the http request coming from mobile or PC . Based on that i want to show jsp page.
We already had a discussion on the same topic... See my post here
This will surely help you.
regards,
Shahid
Ramesh Sengani
Ranch Hand
Joined: Nov 23, 2011
Posts: 36
posted
0
thanks sahid
but i have no idea about user agent also.Is that possible to give me one simple example to fetch coming data from request and based on that redirect for mobile or pc
As already pointed out, you need to sniff the user-agent string. A little research or testing on your own will show you what returned front he different browsers.
Bear in mind that the user-agent can be spoofed so it's not 100% accurate, but it's all you've got to work with.
Even if it's not spoofed, the user agent header is not full proof. My company's website shows me the mobile version when I visit it with Opera on my PC.
I wouldn't worry about the spoofing aspect; if people take care to appear as something other than what they are, then they should not be surprised to be treated as something other than what they are.
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.
subject: Identify request coming from mobile or PC