Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / web / HTML

Browsers View port Width & Height using Javascript

0.00/5 (No votes)
24 Nov 2011CPOL 7.2K  
DescriptionB...

Description


Browsers Width & Height using jQuery

Code


HTML
<html>
<head>
<title>Browsers Width & Height using jQuery</title>
  <script src="http://code.jquery.com/jquery-latest.js"></script>
  <script>
  $(document).ready(function () {
    var height = $(window).height();
    var width = $(window).width();
    alert("Height : " + height + " Width : " + width)
  });
  </script>
</head>
<body>
</body>
</html>

Browser Compatibility


I have tested this script in the following Web browsers:

  • Internet Explorer
  • Mozilla Firefox
  • Google Chrome
  • Safari
  • Opera

jQuery


Download Latest jQuery - http://jquery.com/[^]
jQuery Tutorial - http://www.w3schools.com/jquery/default.asp[^]

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)