Solved

How to retrieve a client's IP adress?

Posted on 2003-12-09
6
1,018 Views
Last Modified: 2008-02-01
Hi!

I want to know if there is a way to retrieve a visitors IP adress using JavaScript.
I could also use JSP if that works better.

Please advise.

Regards,
David
0
Comment
Question by:larsan
  • 3
  • 3
6 Comments
 
LVL 3

Expert Comment

by:mrh30
ID: 9903847
In JSP it's quite easy:

<%
out.print( request.getRemoteAddr() );
out.print( request.getRemoteHost() );
%>
0
 

Author Comment

by:larsan
ID: 9904298
That works on a "standalone" page, but this page in particular is
included into another jsp, and the only IP I'm getting is that of the current server.

Sorry for not mentioning this earlier.

Regards,
David
0
 
LVL 3

Accepted Solution

by:
mrh30 earned 500 total points
ID: 9904312
That's a bit more tricky, since the request is indeed coming from within your server when you do the include.  It's a sort of chain going on.

There might be a way for the 'parent' jsp to find it and then pass the IP as a parameter to the child in some way?
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 

Author Comment

by:larsan
ID: 9904332
Thanks, I'll try that.

Do you know how 'intense' this request is on the server, as the parent is used to present almost everything else on the site.

Pls e-mail me if you do.

/David
0
 
LVL 3

Expert Comment

by:mrh30
ID: 9904360
Sorry I've not got much experience of JSPs.  We tend to develop in Perl/Javascript mainly.  I only know a few little snippets about JSPs.
0
 

Author Comment

by:larsan
ID: 9904410
OK. Thanks anyway!
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How to reload page and grab querystring 2 21
VBScript on Html 15 47
jQuery Dialog Autoresize Bug 2 24
send email part1 9 22
Today I would like to talk about localizing (Internationalization) JavaScript applications. Introduction When creating an application that is going to be used by many people around the globe, it is important to remember that not everyone speak…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

790 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question