Hi i am trying to make a responsive website, and i want to find a way to check whether the device viewing the page is a pc, tablet or phone.
So far, the only solution i could find was variations of this:
# Mobile
only screen and (min-width: 480px)
# Tablet
only screen and (min-width: 768px)
# Desktop
only screen and (min-width: 992px)
# Huge
only screen and (min-width: 1280px)
Correct me if i'm wrong, but the difference in pixel-density in devices is so big, that this can't guarantee anything, and it would also require regular updates based on the development of new screens with higher pixel-density.
I was hoping there was a function that could give you the screens size in real physical inches, or a variable you could call, that would tell you what type the device is.
The goal is to have a piece of code, that i never have to update, but just works no matter the type of device. I'm up for any language, but i'm best at html, css and javascript.
Thank you in advance!