|
Posted by Vince Morgan on 12/28/06 07:15
"toffee" <toffee@toffee.com> wrote in message
news:emvb0j$tk6$1@news.freedom2surf.net...
> Hi all,
>
> just a quick question - is it possible to use php to find out the current
> screen resolution ?
>
> if not maybe somehow make js talk to php ?
>
> many thanks
>
> T
>
>
Not PHP as such. However, if your PHP generated html/xhtml page contains a
form and an hidden input you can set the value of that input via javascript
at the client end, and read that value on form submission at the server
easily. Alternately you could send a very small page with the hidden field
set via javascript using the Body's "onload" event, and post that back
immediately with a javascript submit. Then post (PHP) the page that
requires foreknowledge of the Height and Width info.
It's not altogether an efficient/reliable method though as it requires that
the client has javascript enabled, and if it is, requires that you send two
pages to view only the second one. Perhaps barely noticable on a LAN, but
could be obviously slow on the web for more distant users.
It is almost always better practice to avoid the need to know the res. at
the other end by designing a site that behaves in a fluid manner. However,
I realize that it's not always possible to do that.
HTH,
Vince Morgan
[Back to original message]
|