Want to get the browser viewport dimensions? Use the following example to get the browser viewport height and width. Cross-browser @media (width) and @media (height) values
var w = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
var h = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
@media (height)which include scrollbars
initial-scaleand zoom variations may cause mobile values to wrongly scale down to what PPK calls the visual viewport and be smaller than the
@media (height)when there is no scrollbar
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.