5

Okay I got some good advice for Mobile Detection but still having an issue with themed tablets as the icons will be larger for a tablet view then a mobile device. I'm using jQueryMobile as the framework and it does detect the iPad (And I'm sure other tablets are on the way), but how can I detect if it's a tablet or mobile device? would I just go with the screen size?

If that's the case than what's the largest screen size for a mobile device or the smallest screen for a tablet?

is there a better way?

Community
  • 1
  • 1
Phill Pafford
  • 83,471
  • 91
  • 263
  • 383

5 Answers5

2

jQuery Mobile adds classes to the body tag which allows you to create a single CSS for all the devices.

See here: http://jquerymobile.com/demos/1.0a3/#docs/api/mediahelpers.html

update

As of beta2 helpers will be deprecated and set for removal. You should take a look at media queries which were used to put these classes in there anyway.

Kees de Kooter
  • 7,078
  • 5
  • 38
  • 45
naugtur
  • 16,827
  • 5
  • 70
  • 113
1

Have you considered the benefits of server side detection? OpenDDR offers .NET and Java libraries, licensed under LGPL.

You can have a look at http://www.openddr.org

1

I'd suggest using media queries and targeting a different CSS stylesheet.

Ian Devlin
  • 18,534
  • 6
  • 55
  • 73
  • yes I understand I need a different CSS style sheet per device group but wanted to know how to determine the device? – Phill Pafford Feb 28 '11 at 16:12
  • 1
    Well you can't, as far as I'm aware, target each device separately, but can use media queries (http://css-tricks.com/css-media-queries/) to target different screen sizes, which should help? – Ian Devlin Feb 28 '11 at 17:02
1

Have you ever considered a device detection library like wurfl, tera-wurfl or the proprietary deviceAtlas?

Timo
  • 930
  • 2
  • 10
  • 22
  • yeah I have looked at them, thanks. I do see the need for them in future projects +1 – Phill Pafford Jun 03 '11 at 12:57
  • Keep an eye on the licensing though! We just decided not to use the wurfl java api because it comes with an AGPL licence. – Timo Jun 09 '11 at 05:48
0

We are starting to develop using Formfactor detection libraries such as FormfactorJS - note, I created this.

The theory being using the same semantic HTML, you can specialize your CSS and Javascript using for a given class of device (smartphone, tablet, desktop etc) whilst also being cognizant of responsive design to individual device profile using Media Queries.

Kinlan
  • 16,315
  • 5
  • 56
  • 88