Skip to content

Instantly share code, notes, and snippets.

@avisek
Created October 7, 2018 20:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save avisek/cd19273b3d41941c2ffbc6d5a8711982 to your computer and use it in GitHub Desktop.
Save avisek/cd19273b3d41941c2ffbc6d5a8711982 to your computer and use it in GitHub Desktop.
/** Whether we are using a Mac or not. */
function isMac() {
return /Mac/.test(navigator.platform);
}
/** Whether this is on the Windows platform or not. */
function isWindows() {
return /Win/.test(navigator.platform);
}
/** Whether this is on chromeOS or not. */
function isChromeOS() {
return /CrOS/.test(navigator.userAgent);
}
/** Whether this is on vanilla Linux (not chromeOS). */
function isLinux() {
return /Linux/.test(navigator.userAgent);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment