1

I'm trying to detect if the client is using a tablet in JavaScript. I do not want to use CSS3 or UserAgents if I can. One method that came into my mind was using screen.width property inside the browser to get the device width and detect tablets if the screen.width is less than a certain threshold.

Do you guys think this would be a good solution?

What is the support for this property? Do most tablets support this feature?

Any feedback would be appreciated.

ama2
  • 2,511
  • 2
  • 17
  • 28

1 Answers1

0

I dont't think you are going to achieve what you want with this approach. If you really wanna do this with only javascript and no "magic way" (CSS3, UserAgents, etc ...), I suggest you to simple add a "switch button" just like language buttons ... something like "Switch to view : tablet / desktop".

Felipe Miosso
  • 7,172
  • 6
  • 40
  • 54
  • good suggestion but unfortunately this is not an option for what I'm trying to achieve – ama2 Feb 21 '13 at 19:42
  • Well, I hope you find a way :) But if you find yourself out of ... hmm ... ideas, this might be really helpful http://stackoverflow.com/questions/3514784/best-way-to-detect-handheld-device-in-jquery – Felipe Miosso Feb 21 '13 at 19:50