Posted By


jpdevries on 08/03/10

Tagged


Statistics


Viewed 228 times
Favorited by 0 user(s)

isTouchDevice()


/ Published in: JavaScript
Save to your folder(s)

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?


Copy this code and paste it in your HTML
  1. function isTouchDevice() {
  2. var el = document.createElement('div');
  3. el.setAttribute('ontouchmove', 'return;');
  4. if(typeof el.ontouchmove == "function"){
  5. return true;
  6. }else {
  7. return false
  8. }
  9. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.