4K devices are becoming more popular. I am developing a website and I have a mobile phone with a UHD display. I noticed that the images are blurry. I immediately thought it was 4K. By combining the image size as shown in the examples below, I found that it is no longer blurry.
4K / UHD: <img src="/images/logo-192x128.png" width="96" height="64" />
Standard HD / SD: <img src="/images/logo-96x64.png" width="96" height="64" />
My question is how can you detect a 4K / UHD display using JavaScript so that you can dynamically include dual-resolution images when a 4K display is detected. The reason I want to do this is to reduce the loading time of my pages, since downloading these high resolution images is resource intensive.
source share