Have you ever had the conversation:
Your site doesn't work.
What's a browser?
Browser Details makes that problem disappear by capturing a user's browser details in your logs. You will get the exact browser version they are using and their OS dumped into your logs, and when possible you'll get whether they have JS enabled too. All entirely unobtrustively.
You may never need to speak to a user ever again!
Started GET "/" for 127.0.0.1 at 2012-12-26 21:25:14 +0000 Processing by HomeController#index as HTML ... Started POST "/posts" for 127.0.0.1 at 2012-12-26 21:25:19 +0000 Processing by PostsController#create as HTML ...
Started GET "/" for 127.0.0.1 at 2012-12-26 21:25:14 +0000 Chrome 23.0.1271.95 (Macintosh, Intel Mac OS X 10_7_5) Processing by HomeController#index as HTML ... Started POST "/posts" for 127.0.0.1 at 2012-12-26 21:25:19 +0000 Chrome 23.0.1271.95 (Macintosh, Intel Mac OS X 10_7_5), JS enabled Processing by PostsController#create as HTML ...
Add this line to your application's Gemfile:
And then execute:
Or install it yourself as:
$ gem install browser_details
The middleware will be installed automatically by the Railtie.
for form submissions you must add the following line to your
//= require browser_details
Browser Details requires jQuery to be present as it works by checking if the
utf8 form element has been changed to a large tick from a small tick by the
Other Rack applications
To use the Browser Details middleware you must add the line:
Wherever it may be appropriate for your application.
If you want to use the message elsewhere, you can request the message directly:
details = BrowserDetails.message(request)
- Fork it
- Create your feature branch (
git checkout -b my-new-feature)
- Commit your changes (
git commit -am 'Add some feature')
- Push to the branch (
git push origin my-new-feature)
- Create new Pull Request