Skip to content

Instantly share code, notes, and snippets.

@BlackMix
Last active June 21, 2018 02:18
Show Gist options
  • Save BlackMix/7f149a52a9a24eac9ec224b67e9c60e8 to your computer and use it in GitHub Desktop.
Save BlackMix/7f149a52a9a24eac9ec224b67e9c60e8 to your computer and use it in GitHub Desktop.
/**
* isMobile
* return true in Mobile and false on Desktop
**/
export const isMobile = () => {
return /(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|ipad|iris|kindle|Android|Silk|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp2|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(navigator.userAgent)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment