[Seaside] getting the browser's screen resolution?

Lukas Renggli renggli at gmail.com
Sun Mar 25 08:26:22 UTC 2007


> I know there's a discussion some time ago, but I haven't found a clear
> solution to get the browser's screen resolution. Is there a way to do this
> with Seaside?

There is no difference to PHP, JSP, RoR, ... whatever. You can
basically take any solution from there and take it over to Seaside.

If you use Scriptaculous something like that might work for you:

html script: (html request
	callback: [ :value | width := value ] value: (SUStream on:
'window.innerWidth || document.documentElement.clientWidth ||
document.body.clientWidth || 0');
	callback: [ :value | height := value ] value: (SUStream on:
'window.innerHeight || document.documentElement.clientHeight ||
document.body.clientHeight || 0'))

This generates a new request posting the current values into your
web-applications.  Maybe nicer would be to override #initialRequest:
and do a redirect posting the size, but that wouldn't be that simple
anymore.

Lukas

-- 
Lukas Renggli
http://www.lukas-renggli.ch


More information about the seaside mailing list