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

webmail at pielka.de webmail at pielka.de
Wed Jun 16 15:33:39 UTC 2010


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


More information about the seaside mailing list