<title>My Example</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
$( "button" ).click( function() {
msg = msg + "<p>Width: " + $( window ).width();
msg = msg + "<p>Height: " + $( window ).height();
<button>Get Window Dimensions</button>