Click here to Skip to main content
15,867,568 members
Articles / Web Development / HTML
Alternative
Tip/Trick

Browsers View port Width & Height using Javascript

Rate me:
Please Sign up or sign in to vote.
0.00/5 (No votes)
23 Nov 2011CPOL 7.1K   1  
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)


Written By
Team Leader
India India
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
-- There are no messages in this forum --