Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Identify request coming from mobile or PC

 
Ramesh Sengani
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check this link.

 
Shehzaad khan
Greenhorn
Posts: 5
Eclipse IDE Java MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64833
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Rob Spoor
Sheriff
Pie
Posts: 20527
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Ramesh Sengani
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is no any garrenty proof solution to identify request which diffrenciate pc and mobile?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64833
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nope. No foolproof method.
 
Tim Moores
Bartender
Posts: 2795
38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Ashsih khurana
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use MobileESP here a very efficient page and open source solution to your problem.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic