Hello again, how can I get my current IP address using Ajax helpers, in rails ? I have found solution to get it with java functions : ## <SCRIPT> var ip = new java.net.InetAddress.getLocalHost(); var ipStr = new java.lang.String(ip); document.writeln(ipStr.substring(ipStr.indexOf("/")+1)); </SCRIPT> # but I would like to avoid using java, if it''s possible... any idea ? Thanks, Thib --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
@client_ip = request.remote_ip On Aug 27, 3:22 pm, Thib21 <thibault.c...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hello again, > how can I get my current IP address using Ajax helpers, in rails ? > I have found solution to get it with java functions : > > ## > <SCRIPT> > var ip = new java.net.InetAddress.getLocalHost(); > var ipStr = new java.lang.String(ip); > document.writeln(ipStr.substring(ipStr.indexOf("/")+1)); > </SCRIPT> > # > > but I would like to avoid using java, if it''s possible... > any idea ? > > Thanks, Thib--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Thanks to answer so quickly ! But, is it possible to get it with javascript, instead of ruby ? (if an ajax helper exist for that...) On Aug 28, 4:14 am, Dave S <DaveSh...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> @client_ip = request.remote_ip > > On Aug 27, 3:22 pm, Thib21 <thibault.c...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > Hello again, > > how can I get my currentIPaddress using Ajaxhelpers, in rails ? > > I have found solution to get it with java functions : > > > ## > > <SCRIPT> > > varip= new java.net.InetAddress.getLocalHost(); > > var ipStr = new java.lang.String(ip); > > document.writeln(ipStr.substring(ipStr.indexOf("/")+1)); > > </SCRIPT> > > # > > > but I would like to avoid using java, if it''s possible... > > any idea ? > > > Thanks, Thib--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
you can use $ip = $_SERVER[''REMOTE_ADDR'']; in php script then get it with ajax On Aug 27, 1:22 pm, Thib21 <thibault.c...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hello again, > how can I get my current IP address using Ajax helpers, in rails ? > I have found solution to get it with java functions : > > ## > <SCRIPT> > var ip = new java.net.InetAddress.getLocalHost(); > var ipStr = new java.lang.String(ip); > document.writeln(ipStr.substring(ipStr.indexOf("/")+1)); > </SCRIPT> > # > > but I would like to avoid using java, if it''s possible... > any idea ? > > Thanks, Thib--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---