This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import getAgent from "@egjs/agent"; | |
const agent = getAgent(); | |
if ( | |
agent.os.name === "ios" | |
&& (agent.os.majorVersion >= 10 || agent.isHints) | |
) { | |
console.log("is iOS"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import getAgent from "@egjs/agent"; | |
const agent = getAgent(); | |
if ( | |
agent.os.name === "android" | |
&& (agent.os.majorVersion >= 5 || agent.isHints) { | |
console.log("is Android >= 5"); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import getAgent from "@egjs/agent"; | |
const agent = getAgent(); | |
if ((agent.os.name === "mac" || agent.os.name === "ios") && agent.browser.webkit) { | |
console.log("is mac, ios webkit"); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { getAccurateAgent } from "@egjs/agent"; | |
// Use Promise | |
getAccurateAgent().then(agent => { | |
// Mac OS X 10.15.4, Chrome Canary 87.0.4243.0 | |
// "chrome" | |
agent.browser.name | |
// "87.0.4243.0" | |
agent.browser.version |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import getAgent from "@egjs/agent"; | |
const agent = getAgent(); | |
// Mac OS X 10.15.4, Chrome Canary 87.0.4243.0 | |
// "chrome" | |
agent.browser.name | |
// "87" (before "87.0.4243.0") | |
agent.browser.version | |
// "unknown" (before mac) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// chromium's engine(blink) is based on applewebkit 537.36. | |
export const CHROMIUM_PRESETS: PresetInfo[] = [ | |
{ | |
test: "(?=.*applewebkit/(53[0-7]|5[0-2]|[0-4]))(?=.*\\schrome)", | |
id: "chrome", | |
}, | |
{ | |
test: "chromium", | |
id: "chrome", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
navigator.userAgentData.getHighEntropyValues([ | |
"architecture", | |
"model", | |
"platform", | |
"platformVersion", | |
"uaFullVersion", | |
]).then(info => { | |
console.log(info); | |
}); |