Files
cinny/src/app/utils/user-agent.ts
T

14 lines
426 B
TypeScript
Raw Normal View History

2023-06-12 21:15:23 +10:00
import { UAParser } from 'ua-parser-js';
export const ua = () => UAParser(window.navigator.userAgent);
export const isMacOS = () => ua().os.name === 'Mac OS';
2023-10-18 13:15:30 +11:00
export const mobileOrTablet = (): boolean => {
const userAgent = ua();
const { os, device } = userAgent;
if (device.type === 'mobile' || device.type === 'tablet') return true;
if (os.name === 'Android' || os.name === 'iOS') return true;
return false;
};