Question

as a webpage developer i would like to know if there is any way i can know the aspect ratio of users monitor(those who are using a PC or a Mac). i want to forward different pages(in terms of their page layout) to different users based on their screen size and aspect ratio. is this possible ?

Was it helpful?

Solution

Why not retrieve their desktop size and find the ratio yourself?

var ratio = screen.width / screen.height;
if (ratio == (4/3)) {
  // 4:3 ratio
} else if (ratio == (3/2)) {
  // 3:2
} else if (ration == (16/9)) {
  // 16:9
} /* etc. */
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top