Welcome Guest ( Log In | Register )

Outline · [ Standard ] · Linear+

 PHP detect browser window size, $_Get['width'] ??

views
     
snow
post Apr 30 2009, 12:21 PM

Enthusiast
*****
Senior Member
785 posts

Joined: Jan 2003



You have to either do the if else completely in javascript or use javascript to pass the width to php.

Method 1:

<html>
<body>
<script type="text/javascript">
var w = 0;
if (window.innerWidth) w = window.innerWidth;
else if (document.all) w = document.body.clientWidth;
if (w < 1008) { document.write("less than 1008"); }
else { document.write("more than 1008"); }
</script>
</body>
</html>

 

Change to:
| Lo-Fi Version
0.0951sec    1.17    6 queries    GZIP Disabled
Time is now: 14th December 2025 - 12:35 PM