You could try something along those lines:
<html>
<head>
<script language="JavaScript">
<!--
function fetch_size () {
document.myForm.x = /* some useful code */;
document.myForm.y = /* some useful code */;
document.myForm.submit();
}
-->
<body onload="javascript:fetch_size()">
<form action="/index.php" method="post" name="myForm">
<input type="hidden" name="x" value="-1">
<input type="hidden" name="y" value="-1">
</form>
</body>
</html>
Please remember that I don't know JavaScript,
so this might not even compil^Wwork...