# Passing a browser variable to Rails?

**URL:** <https://www.ruby-forum.com/t/passing-a-browser-variable-to-rails/95185>\
**Category:** Rails\
**Created:** [May 24, 2006, 1:23am UTC](https://www.ruby-forum.com/t/passing-a-browser-variable-to-rails/95185 "2006-05-24T01:23:00Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Philip\_Johnston](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/ce7236/32.png) [@Philip\_Johnston](https://www.ruby-forum.com/u/Philip_Johnston)\
**Post date:** [May 24, 2006, 1:23am UTC](https://www.ruby-forum.com/t/passing-a-browser-variable-to-rails/95185/1 "2006-05-24T01:23:00Z")

</div>

OK so for my first question,

Background :  
I am trying to roll my own fuzzy-time representation algorithm. I want  
to  
pull the Timezone from the browser on page load. I was trying to do it  
through javascript, in the form of

“var visitortime = new Date();  
document.write(”\<SOME HTML ELEMENT" +  
visitortime.getTimezoneOffset()/60);"

- “\>”);

and once that was written I would pull it into my RoR page loading. The  
reason I’m doing this is that I have some dynamic page calls that need  
this  
info without any prior knowledge of the browser (e.g. Trying not to  
create  
an account and having the info specified by the user.).

Question :

-Firstly, is there an elegant way to get at the Timezone information of  
the  
visiting browser?  
-Secondly, I have been looking for documentation about how to access the  
DOM  
from RoR, but can’t quite seem to find it. I keep seeing code segments  
that  
have  
“page[:SOME\_ELEMENT]” and I’m not sure what this is called.  
-Thirdly for future use, is there an elegant way to access the browser  
variables(Width, Height, Timezone …) in general?

Any thoughts?

Phil
