• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Know the Client

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How the server know the device type from which request came from. I have requirement to implement the logic based on the type of the device. Eg: Mobile, TAB, PC or Laptop. Is there any existing API in Jquery to know the details about the client?
 
Marshal
Posts: 28226
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, JQuery doesn't run on the server so maybe that isn't the best way to ask the question. On your server you get all kinds of information about the sender in the HTTP headers, but that would be in your servlet. So I'm going to move this to the Servlets forum.

I don't expect you can distinguish between a PC and a laptop because a laptop IS a PC.
 
Sheriff
Posts: 67747
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why do you need to know? Depending upon what you are trying to do, you may not need to know what the device is, but rather what the capabilities are.

For example, if screen size is what you need to know for CSS, then media queries would be used rather than device detection.

We need to know what you are trying to accomplish before putting forward any recommendations.
 
Sheriff
Posts: 17644
300
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Skanth Chang wrote:Is there any existing API in Jquery to know the details about the client?


Sounds like you're barking up the wrong tree with this. I wouldn't try to start from the JQuery end. If anything, you should start with logic running on the server side, like detecting the user agent that made the request. Then you can control the rendering of the response and setting up the page so JQuery can do something accordingly on the client side. But as Bear said, you should explain what you're trying to do in more detail so you get the right recommendations.
 
Rancher
Posts: 4801
50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If it's simply the acreage of screen you have to work with that you need to know for layout purposes, then you might want to look at something like Bootstrap for your client code.
There are others, but that's the one I have in front of me.

If it's more complex than that then you'd need some other solution.
 
I didn't do it. You can't prove it. Nobody saw me. The sheep are lying! This tiny ad is my witness!
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic