There is no way to do that with PHP.

PHP/JavaScript rule #1:

        PHP = Client Side
        JS  = Server Side

Obviously, client's browser is Client Side and PHP, which is Server Side,
cannot be used for detecting Client's properties on page request (page
wasn't prepared by PHP yet to activate any JS).

With JS you can detect screen sizes by using JavaScript `screen' and
`window' objects.  Find them on developer.netscape.com.

The wildest combination of PHP with client's screen sizes would be adding
JS code into a page that sets the width/height (JS) variables as the
page starts loading to then launch an 1x1 pixel image with these two
variables passed as the URL parameters of the image tag and, the image
is actually to be a PHP script which temporarily records it. 

Comparing the sessions of the current page and image's request you would
be able to retrieve the screen size before continuing the page loads,
adjusting the HTML to fit into that very screen.

But, that is only theoretical. Technically it would mean a lot of
trouble. Firstly because you would need to suspend the page load till
when the client requested that image so your server knows the screen
width/height, to then release the rest of thepage to browser. Not all
browsers will support it either and you might end up in a lot of loops
and slow response times/timeouts.

I have once done something silly like that for a project which *really*
depended on it (a videogame). And, I wouldn't do it once again :)

Best solution? Perhaps using an absolute width for HTML tables (100%)
or a fixed (minimal) page width (775 px recommended)

P.S: Hope this email gets read archived and read from there :)

-- 
Maxim Maletsky
[EMAIL PROTECTED]


On Fri, 31 Jan 2003 20:48:19 -0800 (PST) Dade Register <[EMAIL PROTECTED]> wrote:

> I'm trying to detect the screen size of any client
> browser, or at least IE. Is there a php function that
> can do this? If not, does anyone have any ideas on a
> JS that would work too? Plz help. Thanx.
> 
> __________________________________________________
> Do you Yahoo!?
> Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
> http://mailplus.yahoo.com
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to