[Seaside] How to get JavaScript parameters to Seaside Backend?

Lukas Renggli renggli at gmail.com
Wed Jun 16 15:59:31 UTC 2010


html scriptaculous request
     callback: [ :width | " do something with width " ] value:
(JSStream on: 'window.innerWidth');
     callback: [ :height | " do something with height " ] value:
(JSStream on: 'window.innerWidth')

In Seaside 2.8 use SUStream instead of JSStream.

Lukas

On 16 June 2010 17:33,  <webmail at pielka.de> wrote:
> Hello,
>
> I need the information about the size of the visible browser window in my Seaside application.
> Seems that window.innerWidth and window.innerHeight can be used in JavaScript to detect this information.
> I tried to get it back to Seaside with an Ajax call:
>
>        html document addLoadScript: (
>                html scriptaculous request
>                        addParameter: ('windowInnerWidth=', 'window.innerWidth');
>                        addParameter: ('windowInnerHeight=', 'window.innerHeight');
>                        callback: [
>                                windowInnerWidth := self requestContext request at: 'windowInnerWidth' ifAbsent: [  ].
>                                windowInnerHeight := self requestContext request at: 'windowInnerHeight' ifAbsent: [  ].
>                                Transcript show: windowInnerWidth; cr.
>                                Transcript show: windowInnerHeight; cr.
>                        ]
>        ).
>
> Unfortunately window.innerWidth is not evaluated before the Ajax request but is just handled as String:
>
> Ajax.Request("/s",{parameters:["_s=ZNAk85cmQ6itaH0N","_k=D_bv_q09mSnLjB0U","5","windowInnerWidth=window.innerWidth","windowInnerHeight=window.innerHeight"].join("&")})}/*]]>*/</script>
>
> What do I have to do to get the real values of window size?
>
> Thanks and Best Regards,
> Kai-Uwe
> _______________________________________________
> seaside mailing list
> seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>



-- 
Lukas Renggli
www.lukas-renggli.ch


More information about the seaside mailing list