Introduction
You can use JavaScript and/or CSS media queries to detect and react to the device’s display size. For example, you can change the page’s background color based on the width and height of the screen. There are two different metrics available when measuring display size: screen size and viewport size.- Screen size refers to the size of the device’s physical screen.
- Viewport size refers to the size of the window on the screen.
Amazon-Web-SDKs/Webapps/examples/Cookbook/ScreenSize/
Download the Amazon Web SDKs from the SDK Download page (click the Web button).
Use JavaScript to Detect Display Characteristics
When using JavaScript to detect display size, there are two different objects that correspond to the two different display size metrics:- The
screenobject contains information about the screen size. - The
windowobject contains information about the viewport size.
screen object for the following properties:

