aspose file tools
The moose likes Servlets and the fly likes Identify request coming from mobile or PC Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Servlets
Reply Bookmark "Identify request coming from mobile or PC" Watch "Identify request coming from mobile or PC" New topic
Author

Identify request coming from mobile or PC

Ramesh Sengani
Ranch Hand

Joined: Nov 23, 2011
Posts: 36
Hi,

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.


Please help me..


Thanks in advance
Prashant Chindhade
Ranch Hand

Joined: Jan 19, 2011
Posts: 77
Check this link.

Shehzaad khan
Greenhorn

Joined: May 07, 2012
Posts: 5

Hey Ramesh..

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
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
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56202
    
  13

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.


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19216

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.


SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
Ramesh Sengani
Ranch Hand

Joined: Nov 23, 2011
Posts: 36
There is no any garrenty proof solution to identify request which diffrenciate pc and mobile?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56202
    
  13

Nope. No foolproof method.
Tim Moores
Rancher

Joined: Sep 21, 2011
Posts: 2407
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
 
Similar Threads
Sending SMS from PC to MOBILE
Method to recognise the device from where request is coming
Difference between WML and XHTML
Method to recognise the device from where request is coming
Method to recognise the device from where request is coming