A complete guide to get viewport, device and document sizes with JavaScript
JavaScript provides a native API to get the width and height of a viewport. But it’s important to understand the difference between what sizes you are getting as it may cause you some trouble.