22 Mar

Rails Tip: Accessing User Agent Info via Rails

March 22nd, 2007 — 1:25 pm Dave

Since I couldn’t find the info quickly via Google… If you need to access the user agent info of the browser hitting your app use request.env["HTTP_USER_AGENT"]. Chris had given me a pointer to ‘env’ but I found it tough to quickly find any more information on how to use it. Searches like ‘environment variable rails’ turned up squat. There is a browser detect plugin but it was easier to sneak an example then add the plugin.

Add comment

You are adding a new comment