cobalt/web/src/lib/device.ts

14 lines
343 B
TypeScript
Raw Normal View History

const ua = navigator.userAgent.toLowerCase();
const isIOS = ua.includes("iphone os") || (ua.includes("mac os") && navigator.maxTouchPoints > 0);
const isAndroid = ua.includes("android") || ua.includes("diordna");
const isMobile = isIOS || isAndroid;
const deviceInfo = {
isIOS,
isAndroid,
isMobile,
}
export default deviceInfo;