[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

How to get an IP Address from client

Posted on 2000-03-28
4
Medium Priority
?
163 Views
Last Modified: 2008-02-01
when I use
myAddress=java.net.InetAddress.getLocalHost();
I got "java is undefined"  error

If I can't use this( in NS), what can I use to get the client's ip address?

thanks

lewis





0
Comment
Question by:yuborlau
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 19

Accepted Solution

by:
daveamour earned 200 total points
ID: 2664976
I'm not sure that you can do this with Javascript.  Maybe you can but I don't know how.

You can certainly do this with ASP though

<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<TITLE></TITLE>
</HEAD>
<BODY>
  <P>Your Ip Address is <%=Request.ServerVariables("REMOTE_ADDR")%> </P>
</BODY>
</HTML>

For an example of this look at

http://www4.ewebcity.com/daveamour

Look at the bottom left hadn corner

You can get free ASP hosting by the way at http://www.ewebcity.com and this is all without banners or pop up ads.

Worth checking out if your not into ASP.

Cheers

Dave
0
 
LVL 19

Expert Comment

by:daveamour
ID: 2665020
Further comment

As far as I am aware the following are the only Browser/Client properties available through Javascript.

Note some of these are arrays such as plugin

<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<TITLE></TITLE>
</HEAD>
<BODY>

<SCRIPT LANGUAGE=javascript>
<!--
  document.write ("appCodeName - " + navigator.appCodeName + "<Br>");
  document.write ("appMinorVersion - " + navigator.appMinorVersion + "<Br>");
  document.write ("appName - " + navigator.appName + "<Br>");
  document.write ("appVersion - " + navigator.appVersion + "<Br>");
  document.write ("cookieEnabled - " + navigator.cookieEnabled + "<Br>");
  document.write ("cpuClass - " + navigator.cpuClass + "<Br>");
  document.write ("mimeTypes - " + navigator.mimeTypes + "<Br>");
  document.write ("onLine - " + navigator.onLine + "<Br>");
  document.write ("opsProfile - " + navigator.opsProfile + "<Br>");
  document.write ("platform - " + navigator.platform + "<Br>");
  document.write ("plugins - " + navigator.plugins + "<Br>");
  document.write ("systemLanguage - " + navigator.systemLanguage + "<Br>");
  document.write ("userAgent - " + navigator.userAgent + "<Br>");
  document.write ("userLanguage - " + navigator.userLanguage + "<Br>");
  document.write ("userProfile - " + navigator.userProfile + "<Br>");
//-->
</SCRIPT>

</BODY>
</HTML>

Dave
0
 
LVL 19

Expert Comment

by:daveamour
ID: 2665025
This is a Javascript question isn't it?  Or did you post it in the wrong area?

Dave
0
 

Expert Comment

by:Deathead
ID: 2665250
This is a cross browser IP grabber.. It works in IE due to a CGI call... Enjoy


<!--   REQUIRED BY GGScript   -->
  <script language="JavaScript"> var GG_js = 1.0; </script>
  <script language="JavaScript1.1"> var GG_js = 1.1; </script>
  <script language="JavaScript1.2"> var GG_js = 1.2; </script>
  <script>
   <!--   REQUIRED BY GGScript   -->
    var GG_sk = "Unknown";var GG_cd = 0;var GG_sw = 0;var GG_sh = 0;var GG_dr = GG_sk;var GG_du = GG_sk;var GG_an = GG_sk;var GG_av = GG_sk;var GG_np = GG_sk;var GG_ua = GG_sk;var GG_IPAddr = GG_sk;
    document.URL?GG_du=document.URL:GG_du=GG_sk;document.referrer?GG_dr=document.referrer:GG_dr=GG_sk;navigator.appName?GG_an=navigator.appName:GG_an=GG_sk;navigator.appVersion?GG_av=navigator.appVersion:GG_av=GG_sk;navigator.userAgent?GG_ua=navigator.userAgent:GG_ua=GG_sk;
    if(GG_js >= 1.2)
    {
     if(screen.width)GG_sw=screen.width;if(screen.height)GG_sh=screen.height;if(screen.colorDepth)GG_cd=screen.colorDepth;
     GG_cd==2?GG_cd="4":(GG_cd==4?GG_cd="16":(GG_cd==8?GG_cd="256":(GG_cd==16?GG_cd="65K":(GG_cd==24?GG_cd="16.7M":(GG_cd==32?GG_cd="16.7M":dd=0)))));
     navigator.platform?GG_np=navigator.platform:GG_np=GG_sk;
    }
    if(GG_js >= 1.1)
     document.write("<script language=\"JavaScript1.1\" src=\"http://www.ggscript.com/GGScript/GG_IP.cgi?"+GG_du+"^"+escape(GG_an)+"^"+escape(GG_ua)+"^"+escape(GG_np)+"^"+GG_sw+"^"+GG_sh+"^"+GG_cd+"^"+escape(GG_dr)+"\"></"+"script>");
    // -->
   </script>
   <script>
    <!--
     // REQUIRED BY GGScript
     // do not remove, Netscape 3 needs this...
      document.write(" ");
    // -->
   </script>

<script>
    <!--
     // This is for the IP Address
     if(GG_IPAddr != GG_sk)
      document.write("<B>Your IP address:</B><BR>"+GG_IPAddr+"<BR><BR>")

    // -->




   </script>
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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

Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
In this blog, we’ll look at how improvements to Percona XtraDB Cluster improved IST performance.
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…

656 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