Eric Woodward wrote:> I am trying to post the current brower window sizes into the
user''s
> session file with a form_remote_tag call as follows:
>
> <%= form_remote_tag :url => url_for(:controller =>
"welcome", :action
> => "login", :iheight => "1", :iwidth =>
"2") %>
>
> But how do I get the DOM data for window.innerHeight and
> window.innerWidth into an ruby ERB variable such that I can put into
> the helper, and POST them in to the controller? Or is there a better
> way? I feel like I am missing some really simple here.
>
> Anyone come up against this, and / or know the answer? If so, please
> help.
>
> --ejw
>
> Eric Woodward
> Email: ejw@statewood.com
Since Rails doesn''t actually run on the client, rails only has the info
that was included in the request to go on, and screen size is not in the
request that browser make to your app.
So...
You need to render the page first and then use javascript to trigger an
AJAX call that posts some variables back to the server. Something like
Ajax.Request(''/users/screen_size?width=''+screenWidth()+''height=''+screenHeight());
--
Posted via http://www.ruby-forum.com/.