Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Ruby (http://www.velocityreviews.com/forums/f66-ruby.html)
-   -   Detect Browser Dimension (http://www.velocityreviews.com/forums/t826984-detect-browser-dimension.html)

ceedub.industries@gmail.com 12-15-2005 04:52 PM

Detect Browser Dimension
 
Dear all,

I've just been turned on to Ruby and am trying to code a first Ruby
CGI. I've already hit a brick wall.

I'm looking to see if there is a method similar to PHP's screen.width()
and screen.height() so I can dynamically send different sized pictures
depending on the agent's screen resolution.

-Christopher


ako... 12-15-2005 10:47 PM

Re: Detect Browser Dimension
 
CGI is a code that executes on the server. the server does not know
anything about the client that submits a request unless the client
tells it about itself. there is no way to find out the screen size of
the client's browser unless the client side code submits a request to
the CGI containing the dimentions. the client even can have no browser
at all as far as the CGI script is concerned.

konstantin


Justin Collins 12-16-2005 02:08 AM

Re: Detect Browser Dimension
 
ceedub.industries@gmail.com wrote:
> Dear all,
>
> I've just been turned on to Ruby and am trying to code a first Ruby
> CGI. I've already hit a brick wall.
>
> I'm looking to see if there is a method similar to PHP's screen.width()
> and screen.height() so I can dynamically send different sized pictures
> depending on the agent's screen resolution.
>
> -Christopher
>
>

One way to do this would be to use Javascript's screen.width and
screen.height to set some hidden input values and then read those with
the CGI script.

-Justin



Adam Sroka 12-16-2005 03:25 AM

Re: Detect Browser Dimension
 
Justin Collins wrote:
> ceedub.industries@gmail.com wrote:
>> Dear all,
>>
>> I've just been turned on to Ruby and am trying to code a first Ruby
>> CGI. I've already hit a brick wall.
>>
>> I'm looking to see if there is a method similar to PHP's screen.width()
>> and screen.height() so I can dynamically send different sized pictures
>> depending on the agent's screen resolution.
>>
>> -Christopher
>>
>>

> One way to do this would be to use Javascript's screen.width and
> screen.height to set some hidden input values and then read those with
> the CGI script.
>
> -Justin
>
> .
>

A more modern approach would be to use an AJAX request to send the
values to the server side. You could do this onload(), and then again
onresize() (Supported by all but Opera.) Of course, if you're using
Javascript you could make most adjustments on the page and avoid the
round trip (Unless the issue *requires* a server side adjustment, like
building a graphic on the fly or something.)




All times are GMT. The time now is 04:13 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.