Cuando necesites saber la resolución has lo siguiente entre el <body> y el </body>:
Código PHP:
include 'resolucion.inc.php';
resolucion.js
Código:
function SetCookie(obligar) {
document.cookie = 'PHPRes='+screen.width + 'x' + screen.height;
if (obligar == 1 && document.cookie != '')
document.location.href=document.location.href;
}
function ChequearResolucion(ancho, alto) {
if(ancho != screen.width && alto != screen.height) {
SetCookie();
}
}
resolucion.inc.php
Código PHP:
<script src="resolucion.js" type="text/javascript"></script>
<script type="text/JavaScript">
<!--
<?
$res = array(0,0);
if(isset($_COOKIE['PHPRes']) || !empty($_COOKIE['PHPRes']))
{
$res = explode("x",$_COOKIE['PHPRes']);
$resolucion = array(intval($res[0]), intval($res[1]));
unset($res);
echo 'ChequearResolucion('.$resolucion[0].', '.$resolucion[1].');';
} else {
echo 'SetCookie('.((isset($resolucion_obligar))?1:0).');
';
}
?>
//-->
</script>
Anda de lujo, yo lo uso en mi página de
wallpapers.