Skip to content

Instantly share code, notes, and snippets.

@daybrush
Created September 2, 2020 02:59
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 daybrush/570312e3cb8292d360ae12383f1f123f to your computer and use it in GitHub Desktop.
Save daybrush/570312e3cb8292d360ae12383f1f123f to your computer and use it in GitHub Desktop.
import getAgent from "@egjs/agent";
const agent = getAgent();
// check Mac
export const isMacintosh = agent.os.name === "mac";
// for pc mode in iOS
export const isIOS = (isMacintosh || agent.os.name === "ios") && !!navigator.maxTouchPoints && navigator.maxTouchPoints > 0;
// check android 4
export const isAndroid4 = agent.os.name === "android" && agent.os.majorVersion === 4;
// check safari
export const isSafari = agent.browser.name === "safari";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment