Skip to content

Instantly share code, notes, and snippets.

@murayama
Created July 9, 2013 01:35
Show Gist options
  • Save murayama/5953971 to your computer and use it in GitHub Desktop.
Save murayama/5953971 to your computer and use it in GitHub Desktop.
jsでタッチデバイスの判定
// pcでユーザーエージェントを偽装されてアクセスされていても、これである程度判定できるはず
function isTouchDevice() {
return ($.browser.mobile && (('createTouch' in document) || ('ontouchstart' in document)) && ('orientation' in window));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment