Because all frameworks I found, fail at least at one of the following points:
- dip values, this means device independant pixels
- manually modifing the viewport with browser zoom level delivers the manually set values (zoom 50% = double viewport)
- automatical device zoom is ignored (typically set on mobile browsers for large content)
- pinch zoom on touch devices is ignored
noCache: boolean
(default: false
) set to true
so skip cached values from previous measurements
Note: Measuring the viewport with this method is somehow expensive for pages without viewport meta-tag set the width to device-width
var viewport = getViewport();
Returns an object with two int values
{
width: <int>,
height: <int>
}