Skip to content

undeviceUnified Device Detector

Device, OS, and browser detection from headers. Dependency-free, typed, and ready for CDN signals.

undeviceundevice
ts
import { 
undevice
} from 'undevice'
const {
detect
} =
undevice
()
const
device
=
detect
({
userAgent
:
navigator
.
userAgent
})
device
.
isMobile
device
.
isDesktop
device
.
isWindows
device
.
isChrome
ts
// This example uses the third-party library isbot
import { 
isbot
} from 'isbot'
import {
undevice
} from 'undevice'
// Configure custom flags const {
detect
} =
undevice
({
isCrawler
:
isbot
,
isRawClient
: ['curl', 'wget'],
}) const
device
=
detect
({
userAgent
:
navigator
.
userAgent
})
device
.
isMobile
device
.
isDesktop
device
.
isWindows
device
.
isChrome
// Use custom flags
device
.
isCrawler
device
.
isRawClient

Released under the MIT License.
not affiliated with the unjs org.