/ Published in: JavaScript
Google Chrome 5.0.375.125 on Mac OS X 10.6 presents itself returns true for this function, even though its not really a touch device?
Expand |
Embed | Plain Text
function isTouchDevice() { var el = document.createElement('div'); el.setAttribute('ontouchmove', 'return;'); if(typeof el.ontouchmove == "function"){ return true; }else { return false } }
Comments
Subscribe to comments
You need to login to post a comment.

Or the shorter:
function isTouchDevice() { var el = document.createElement('div'); el.setAttribute('ontouchmove', 'return;'); return typeof el.ontouchmove == "function"; }