Touch device detection

65 views
Skip to first unread message

Pavel Dohnal

unread,
Jul 2, 2013, 8:13:50 AM7/2/13
to est...@googlegroups.com
Hello,
is there any way in google closure how to detect touch devices? I was googling for javascript detection of the touch devices and it seems to me that it is not easy. I hope that engineers at Google solved this problem and put detection into closure.

Daniel Steigerwald

unread,
Jul 2, 2013, 8:26:45 AM7/2/13
to est...@googlegroups.com
Sure they did and very well. And Este is even better :)

Don't detect JavaScript version, you have to detect devices via user agents. That's what goog.userAgent is for. But goog.userAgent was written in pre-mobile age. So what? Use goog.labs.userAgent and it's methods. It's labs stuff, but works very well. Take a loot at:
goog.labs.userAgent.device.isMobile
goog.labs.userAgent.device.isTablet
goog.labs.userAgent.device.isDesktop

Touch support is Closure Library is another issue. goog.fx.Dragger works with touch event well, but what your code?  Your code should support both click and touchstart. But not directly! That's why I created https://github.com/steida/este-library/blob/master/este/events/taphandler.coffee

Recently Google released whole new library, polymer-project.org. I borrowed it's PointerEvents and PointerGestures, polished them and reused for Este. Take a look at: https://github.com/steida/este-library/blob/master/este/events/gesturehandler.coffee

I hope this helps.




On Tue, Jul 2, 2013 at 2:13 PM, Pavel Dohnal <pavel....@twobits.cz> wrote:
Hello,
is there any way in google closure how to detect touch devices? I was googling for javascript detection of the touch devices and it seems to me that it is not easy. I hope that engineers at Google solved this problem and put detection into closure.

--
You received this message because you are subscribed to the Google Groups "Este.js - The state of art Javascript framework and dev stack" group.
To unsubscribe from this group and stop receiving emails from it, send an email to estejs+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Reply all
Reply to author
Forward
0 new messages