Detects (mobile) device used based on screen dimensions (width, height, dppx). Includes list of all devices.
Open this link on a mobile device. If it couldn't be detected please open a pull request for it.
$ npm install detect-device
import { detect, devices } = 'detect-devices'
const detectedDevice = detect()
console.log(detectedDevice)
\\ { "name": "Apple iPhone 6", "width": 750, "height": 1334, "diagonal": 4.7, "ppi": 326, "dppx": 2 }
const iPhone5 = detect({
width: 640,
height: 1136,
dppx: 2
})
console.log(iPhone5)
\\ { "name": "Apple iPhone 5", "width": 640, "height": 1136, "diagonal": 4, "ppi": 326, "dppx": 2 }
console.log(devices)
// ... lists all available devices
Description of the device. Includes vendor and model.
Absolute height of device screen in pixel.
Absolute height of device screen in pixel.
Diagonal screen size in inch.
Distance between screen and device body in inch. (deviceWidthInInch
- screenWidthInInch
) / 2 = frame
.
Points per inch. Read more.
Scaling factor. Sometimes also called "retina".