Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9253805
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T11:18:39+00:00 2026-06-18T11:18:39+00:00

I need to find User’s local IP. The server is behind a router, so

  • 0

I need to find User’s local IP. The server is behind a router, so I cannot use any server-side method. I also don’t want to use any 3rd party service like http://jsonip.appspot.com/ because I tested it and its server goes down from time to time.

Using Java, I I want to get the IP through something like

<script type="text/javascript">
        function myIP() {
            var yip2 = java.net.InetAddress.getLocalHost();
            var yip = yip2.getHostAddress();
            return yip;
        } //end myIP

        alert("your machine's local network IP is " + myIP())
    </script>

but It’s not working. How can I get it work?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T11:18:41+00:00Added an answer on June 18, 2026 at 11:18 am
    1. no server-side
    2. no third-party

    Sounds like you are "stuck" with what you have already provided. Your script actually got me curious because on first glance it did seem you were mixing server and client (java and javascript) + all the comments pointed to it. But curiosity is good thing 🙂

    Apparently, though not really reliable you can call Java methods in supporting browsers. Java is client side too (the concept that was lost).

    I will copy and paste this, I’ve never tried (because I’ve never been limited the same way as you are):

    if (java && java.net)
    ip = ''+java.net.InetAddress.getLocalHost().getHostAddress();
    else ip = 'unknown';
    

    Taken from About.com – which also describes what you need to do to at least give it a chance to work (upload, can’t do it from local).


    UPDATE:

    Forget it. I’m not a java guy (in the first place), as @Esailija has noted, the script above will not (no longer) work:

    2.1.5 Deprecated Functionality: the Global Packages, java and netscape Keywords

    The Mozilla family of browsers has historically provided
    support for access to the Java language from JavaScript even on web
    pages that don’t contain Java applets. In this browser family, there
    are global java, netscape and Packages keywords available to
    JavaScript code which allow calling static methods, accessing static
    fields, and creating new instances of Java classes in similar fashion
    to the per-applet Packages keyword above.

    The semantics of these keywords becomes problematic when more than one
    applet is available on the web page. If you want to access one
    particular applet’s user-defined classes (for example, in a
    com.mycompany package), how would the global Packages keyword know
    which applet to refer to? The new Java Plug-In also supports attaching
    more than one Java virtual machine instance to the web browser for
    executing applets. The semantics of these global keywords becomes even
    more complicated in this situation.

    For this reason, the global java, netscape and Packages JavaScript
    keywords are deprecated.
    They continue to function in the Firefox
    browser, but it is strongly recommended to transition existing code
    using them to use the new per-applet Packages keyword. It is not
    possible to access user-defined classes using these global keywords;
    attempts to do so will yield undefined results.

    Reference here

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need find out that my windows currentuser is domain user or local user?
I am building a custom admin extension, I need to find a user's role
I need to find out the word in an image where user has clicked.
Given a user input string, I need to find if it end with one
I need to find out the user who has posted the most number of
I need to find out if a specific user belongs to a particular group
I need to find the user who is logged into the current session. I
I need to find all the groups a particular user is a member of.
I need to find out if two dates the user selects are the same
How can I do something like this in range? User.find(14000..14500) I need to choose

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.