[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Getting Browser information

Veera Sundaravel

4/25/2007 10:19:00 PM

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.

--
Posted via http://www.ruby-....

5 Answers

Ganesh Gunasegaran

4/25/2007 10:36:00 PM

0

request.env["HTTP_USER_AGENT"]

Cheers,
Ganesh Gunasegaran.

On 26-Apr-07, at 3:49 AM, Veera Sundaravel wrote:

> 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.
>
> --
> Posted via http://www.ruby-....
>


Veera Sundaravel

4/26/2007 12:57:00 AM

0

Ganesh Gunasegaran wrote:
> request.env["HTTP_USER_AGENT"]
>
> Cheers,
> Ganesh Gunasegaran.

Hello sir!

Thank you very much for your prompt reply .

Regards,
Veeraa.

--
Posted via http://www.ruby-....

Veera Sundaravel

4/26/2007 1:50:00 AM

0

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.

--
Posted via http://www.ruby-....

Tim X

4/26/2007 10:06:00 AM

0

Veera Sundaravel <veeraa2003@yahoo.co.in> 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

--
tcross (at) rapttech dot com dot au

Pau Garcia i Quiles

4/26/2007 11:06:00 AM

0

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.sourc.... 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.e...
(Due to the amount of work, I usually need 10 days to answer)


Quoting Veera Sundaravel <veeraa2003@yahoo.co.in>:

> 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.
>
> --
> Posted via http://www.ruby-....
>
>