Skip to content

OS Detect

Lightweight OS and device-type detection for browsers, Node.js, and SSR — with React hooks and Vue composables. No dependencies.

OS detection and boolean checks

The getOS() function returns the current OS identifier: iOS, macOS, Android, Windows, Linux, ChromeOS, or unknown. Additional boolean functions (detectIsIOS, detectIsWindows, and others) let you flexibly check specific systems with no extra dependencies.

Async Windows 11 detection

detectIsWindows11() asynchronously detects Windows 11 in the browser (via getHighEntropyValues) and in Node.js (via os.release). Returns true only for Windows 11, letting you distinguish it from Windows 10 and older without complex parsing.

Device categories and correct iPadOS

isMobileDevice() and isDesktopDevice() provide quick coarse classification. The iOS detector correctly handles iPadOS 13+, which masquerades as Macintosh in the userAgent, using navigator.maxTouchPoints for accurate differentiation.

Ready-to-use hooks for React and Vue

useOS() (sync) and useIsWindows11() (async with null state) are available for React and Vue. React hooks use useMemo/useState, Vue composables return readonly refs. All are SSR-safe and auto-update when the detection completes.

SSR, Node.js, and zero dependencies

In Node.js, the library reads process.platform, and all functions cache the result after the first call. Cache reset is available for testing. The package has no external dependencies, ships in ESM, CJS, and UMD, with React and Vue as optional peer dependencies.