Skip to content

Instantly share code, notes, and snippets.

@lakinmohapatra
Created March 11, 2016 11:39
Show Gist options
  • Save lakinmohapatra/669f001b101b603bd6ad to your computer and use it in GitHub Desktop.
Save lakinmohapatra/669f001b101b603bd6ad to your computer and use it in GitHub Desktop.
Check for touchscreen devices using javascript
function is_touch_device() {
return (('ontouchstart' in window)
|| (navigator.MaxTouchPoints > 0)
|| (navigator.msMaxTouchPoints > 0));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment