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.


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

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

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


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)