Skip to content

Instantly share code, notes, and snippets.

@ahmednuaman
Created November 16, 2010 15:55
Show Gist options
  • Save ahmednuaman/701964 to your computer and use it in GitHub Desktop.
Save ahmednuaman/701964 to your computer and use it in GitHub Desktop.
A simple little script to check for a touch enabled device
var el = document.createElement( 'div' );
el.setAttribute( 'ontouchstart', 'return;' );
if ( typeof el.ontouchstart == 'function' )
{
// yay a touch device!
}
@ahmednuaman
Copy link
Author

Interesting... Must've been the sleepless nights of the project that caused me to come up with this special way!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment