I want retrieve the width and height of browser in pixel(px) using ruby code. I don’t have any idea how to do this.
Please help
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
With the help of Javascript you can calculate the width and height of browser and pass this info to server using AJAX .
Else not possible by ruby code .
EDITED :
If you are working on rails app than you can do it like :
To get the browser dimension use the link :
http://www.howtocreate.co.uk/tutorials/javascript/browserwindow
And if you using jQuery then use below function to get the height and width of window .
And use Ajax feature to pass this dimension to your action .