Hi Folks, I am explaining you how to get browser window width and height in Javascript . we can get dimensions of the browser window height and width peoperties using window object in javascript.
window.outerWidth : using the javascript code. it will provide overall width of the browser window.
window.outerHeight : it can provide overall height of the browser window inclusive of toolbars etc.
window.innerWidth : it can provide width of the area within the webpage area is displaying.
window.innerHeight : it can provide height of the area within which the webpage area is displaying.
Example :
<!DOCTYPE html>
<html>
<head>
<title>How to get browser window width and height in Javascript ? </title>
</head>
<body>
<script type="text/javascript">
var outerWidth=window.outerWidth;
var outerHeight=window.outerHeight;
var innerWidth=window.innerWidth;
var innerHeight=window.innerHeight;
console.log(outerWidth+' fetch outerWidth');
console.log(outerHeight+' fetch outerHeight');
console.log(innerWidth+' fetch innerWidth');
console.log(innerHeight+' fetch innerHeight');
</script>
</body>
</html>
Output :
Hello, Welcome to webdeveloperindia.in. I am a full-stack web developer. Email – [email protected] | Skype – azaruddin23. I have knowledge of PHP, Laravel, Magento 1/2, Codeigniter, WordPress, Joomla, Shopify, Git, Bitbuket, jQuery, Ajax, Javascript and ReactJS.