Getting Browser information

HI everybody,

I’m newbie to ruby. I want to get user’s browser and OS information like
getting ip address using request.remote_ip. Is it possible.

Regards,
Veeraa.

request.env[“HTTP_USER_AGENT”]

Cheers,
Ganesh G…

Ganesh G. wrote:

request.env[“HTTP_USER_AGENT”]

Cheers,
Ganesh G…

Hello sir!

Thank you very much for your prompt reply .

Regards,
Veeraa.

Hi,

I have one more doubt, here i want split the browser and OS information.
But using split function is not good one. Any other way.

Regards,
W3matter.

Veera S. [email protected] writes:

HI everybody,

I’m newbie to ruby. I want to get user’s browser and OS information like
getting ip address using request.remote_ip. Is it possible.

Regards,
Veeraa.

This information is part of the standard ‘agent’ information passed by
browsers
as an environment variable (well accessible as an environment variable).
However, note that this information cannot be trusted (ie. its easy to
fake and
some browsers actually provide ways of faking it).

How you actually access this information depends on whether your using a
ruby
library or just reading the data from stdin from the server etc. Most
libraries
provide an ENV hash or object that you can query.

Tim

Hello,

As you have been tool, user agent information is not 100% reliable.
Formerly, object detection was the way to go, but this is also broken
since Gecko and others faked the implementation of some objects (for
instance, document.all).

I think if someone fakes his user agent he is liable for the damage
and carry on with the consequences (i. e. not being able to view the
website properly). What you should never do is have your security
depend on browser detection as that is always fake-able (even if the
evil guy has to recompile Mozilla to say it is Internet Explorer
SuperSecureEdition).

That being said, you can use my Javascript Browser Sniffer library to
detect the browser: http://jsbrwsniff.sourceforge.net. You can use it
on the client side (Javascript is executed on the client) or on the
server side (Javascript is executed on the server, this only works
with IIS/ASP as long as I now).


Pau Garcia i Quiles
http://www.elpauer.org
(Due to the amount of work, I usually need 10 days to answer)

Quoting Veera S. [email protected]:

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs