hi..i wan to ask how to use PHP to check the browser window size ? if let say, my code:
<?
$myWidth = '<script> document.write(window.innerWidth); </script>';
echo $myWidth;
if ($myWidth < 1008) { //when i resize the browser window to 1024x768px, the echo $myWidth is 1008
$setWidth = 550;
echo '<div id="Panorama" style="width:'.$setWidth.'px; height:130px;overflow:hidden; background-color: transparent; margin-top:5; padding: 20px; margin-left: 0px;">';
} else { //when i resize the browser window to 1280x800px, the echo $myWidth is 1264
$setWidth = 750;
echo '<div id="Panorama" style="width:'.$setWidth.'px; height:130px;overflow:hidden; background-color: transparent; margin-top:5; padding: 20px; margin-left: 0px;">';
}?>
My problem is : No matter how i resize the browser window size, it always go to if ($myWidth < 1008){}...i cant get the $setWidth correctly, anything wrong in my code?
This post has been edited by CodeBasic: Apr 30 2009, 11:24 AM
PHP detect browser window size, $_Get['width'] ??
Apr 30 2009, 11:22 AM, updated 17y ago
Quote
0.0175sec
0.99
5 queries
GZIP Disabled