[PHP-JS] Résolution d'ecran OK mais code pas parfaite
Bonjour,
Avec le bout de code plus bas j'arrive a appliquer une résolution = a l'ecran du visiteur.
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
| <script type="text/javascript">
<!-- debut
function resolution() {
document.location="<?php echo $_SERVER['PHP_SELF']; ?>?<?php echo $_SERVER['QUERY_STRING']; ?>&width="+screen.width+"&height="+screen.height;
}
// fin -->
</script>
</head>
<?php
if(!isset($_GET['width']) and !isset($_GET['height'])){
echo '<body onload="resolution();">';
}else{
echo '<body>';
}
$height = $_GET['height'];
$width = $_GET['width'];
$resolution = "$width$height";
// appliquer au template
//$templatewidth ="1024";
$templatewidth =$width; |
......
..
?>
Tous fonctionne bien mais, quand je veut éditer un article sur joomla je me retrouve rediriger a la page d'accueil.
Ma question est est-il possible de récupérer tout simplement la résolution width du visiteur sans pour autant rediriger le navigateur a chaque fois.
Merci d'avance