开发者

Rails 3: How to store screen resolution?

I want to store user's screen resolution in database when user login. How to detect and store it to 开发者_如何学编程database when user login?


Read it with JavaScript (browsers don't send screen resolution information by default, so it isn't available to Ruby or anything else server side unless you make it so), then generate a hidden input, set the name and value based on the data you've gathered, then add it to the form containing the username and password inputs.

Oh, and you might find the window size more useful than the screen resolution. Not everybody maximizes their windows.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜