Below are the headers your browser sent with this request:
| Header Name | Value |
|---|
| Header Name | Value |
|---|
| Header Name | Value |
|---|
Modern browsers send special headers called Client Hints (prefixed with sec-ch-) that provide information about the user's device, preferences, and browser capabilities. These headers help websites deliver optimized content without having to use JavaScript for detection.
To detect and use these headers on your server:
app.get('/detect-browser', (req, res) => {
const browserInfo = {
browser: req.headers['sec-ch-ua'],
platform: req.headers['sec-ch-ua-platform'],
isMobile: req.headers['sec-ch-ua-mobile'] === '?1',
colorScheme: req.headers['sec-ch-prefers-color-scheme'],
reducedMotion: req.headers['sec-ch-prefers-reduced-motion']
};
res.json(browserInfo);
});
<?php
$browserInfo = [
'browser' => $_SERVER['HTTP_SEC_CH_UA'] ?? 'Not available',
'platform' => $_SERVER['HTTP_SEC_CH_UA_PLATFORM'] ?? 'Not available',
'isMobile' => ($_SERVER['HTTP_SEC_CH_UA_MOBILE'] ?? '?0') === '?1',
'colorScheme' => $_SERVER['HTTP_SEC_CH_PREFERS_COLOR_SCHEME'] ?? 'Not available',
'reducedMotion' => $_SERVER['HTTP_SEC_CH_PREFERS_REDUCED_MOTION'] ?? 'Not available'
];
header('Content-Type: application/json');
echo json_encode($browserInfo);
?>