65.9K
CodeProject is changing. Read more.
Home

Browsers View port Width & Height using Javascript

emptyStarIconemptyStarIconemptyStarIconemptyStarIconemptyStarIcon

0/5 (0 vote)

Nov 24, 2011

CPOL
viewsIcon

7230

DescriptionB...

Description

Browsers Width & Height using jQuery

Code

<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[^]