client.display.height

INTEGER, read-only.

Available inall subroutines.

The total number of addressable pixels in the vertical direction of the display on the client device, when held in its default orientation.

Examples

You can use arithmetic in VCL to calculate the number of megapixels for a display:

sub display_mp FLOAT {
declare local var.mp FLOAT;
if (client.display.height > 0 && client.display.width > 0) {
set var.mp = client.display.height;
set var.mp *= client.display.width;
set var.mp /= 1000000;
}
return var.mp;
}

You can find the default orientation of a client device (regardless of its current orientation):

sub display_orientation STRING {
if (client.display.height > 0 && client.display.width > 0) {
return if (client.display.height > client.display.width, "portrait", "landscape");
} else {
return "unknown";
}
}

User contributed notes

BETA

Do you see an error in this page? Do you have an interesting use case, example or edge case people should know about? Share your knowledge and help people who are reading this page! (Comments are moderated; for support, please contact Fastly support)