This question in SOen may be of interest. In particular, I compile here some of the suggestions given.
Get page and browser sizes, with jQuery:
$(window).height(); // altura do browser
$(document).height(); // altura do documento HTML
$(window).width(); // comprimento do browser
$(document).width(); // comprimento do documento HTML
Get screen size:
screen.height;
screen.width;
Alternative without jQuery:
var w = window,
d = document,
e = d.documentElement,
g = d.getElementsByTagName('body')[0],
x = w.innerWidth || e.clientWidth || g.clientWidth,
y = w.innerHeight|| e.clientHeight|| g.clientHeight;
Another way to get screen dimensions, apparently supported by browsers in general:
alert(window.screen.availWidth);
alert(window.screen.availHeight);
I tested them in the browser console (Firefox 27.0.1), and they all work. It is a matter of seeing which measure you are most interested in, possibly the one in the browser window.
I do not know if this data can be sent along with the page request. However, you can opt for lazy loading of the images, if at all possible. I would use some temporary element in the HTML to fill the space, and give the user the understanding that something is still missing. And then, have the right images loaded as fast as possible. Example:
<!DOCTYPE html>
<html>
<head>
<script>
$(document).ready(function () {
if ((window.screen.availHeight < 1234) &&
(window.screen.availWidth < 1234))
document.getElementById("img1").src = "small";
else
document.getElementById("img1").src = "big";
})
</script>
</head>
<body>
<img id="img1" src=""/>
<p>Algum texto.</p>
</body>
</html>
Alternatively, you can take a look at the CSS3 media queries if you help. Here's a article that talks a little about it.