开发者

Rails 3: Support form that auto Find Users OS and Browser info

开发者 https://www.devze.com 2023-02-15 04:45 出处:网络
I\'m building a support form for my application. I\'d like the user to include their Operating System and Browser they are using, catch is the general users either don\'t care to look this stuff up or

I'm building a support form for my application. I'd like the user to include their Operating System and Browser they are using, catch is the general users either don't care to look this stuff up or don't know how. I'd like to add a text-input that automatically grabs this information for the user and displays it in the text field.开发者_运维知识库 Not sure how to go about doing this as I'm new to rails. I'm assuming I'd have to tie this in with javascript or a model that is attached to the form.

Any ideas would be appreciated.


you can read it on the server side so there is no need to bother the users.

request.env['HTTP_USER_AGENT'] should do the trick. You can also read some more information like the accept language or accept encoding. Just look at the keys like this: request.env.keys and check what could be of use to you.

0

精彩评论

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