Is it possible in JavaScript to detect if the browser's monitor supports HDR?
I have the requirement to display a HDR certificate on a webpage when the visitor is using a HDR monitor, but I've expressed to the client that this might not be possible. We've been able to embed video that supports HDR and it plays back correctly on Chrome for Windows.
So far in my research I've found no way of detecting such a capability.
The closest thing I've found is the Screen.colorDepth API
Made a few experiments from the code suggested by @Andreas and tweaked it a tiny bit.
if (screen.colorDepth > 24 && window.matchMedia('(color-gamut: p3)').matches) {
/* use HDR content */
} else {
/* use SDR content */
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With