by Robert Hashemian

JavaScript Visitor IP Address and Host Name

  • A free and simple JavaScript code to tell your visitors what their IP address and Host name are. The information is displayed to the users at your desired location on your Web pages.
  • The client IP address is stored in variable "VIH_HostIP". The client host name, if available, is stored in variable "VIH_HostName". You can use these variables in your own JavaScript code, if desired.
  • You can omit the "VIH_BackColor", "VIH_ForeColor", "VIH_FontPix", "VIH_DisplayFormat", and "VIH_DisplayOnPage" parameters. Default values will be used in that case.
  • "VIH_DisplayFormat" allows you to format the display to your liking. For example, instead of the default English, you can use terms from your own language, or make any other desired adjustments, like omitting the IP address.
  • If "VIH_DisplayOnPage" is set to "no", client information will not be printed. This option is useful if you want to use your own JavaScript code utilizing the "VIH_HostIP" and/or "VIH_HostName" variables.

  • Here's the simple JavaScript code to display visitors' IP addresses and host names (copy and paste to your Web page):
    <script language="JavaScript">
    VIH_BackColor = "palegreen";
    VIH_ForeColor = "navy";
    VIH_FontPix = "16";
    VIH_DisplayFormat = "You are visiting from:<br>IP Address: %%IP%%";
    VIH_DisplayOnPage = "yes";
    <script language="JavaScript" src=""></script>
    Here is what the user will see: (Data will vary depending on user's point of access.)

  • To get DNS or Reverse DNS information on an IP address, try Reverse whois/rDNS.
  • Want complete information about your Internet connection? Try My IP Address/Whoami.
  • Want to script this yourself using server-side code? Read blog entry, IP address and Host name Scripts.

  • Have a comment about the JavaScript Visitor IP Address/Host?
    View/Add comments

    *** From *** see descriptions

    Read Financial Markets  |   Home  |   Web Tools  |   Blog  |   News  |   Articles  |   FAQ  |   About  |   Privacy  |   Contact
    Give a few Sats: 1GfrF49zFWfn7qHtgFxgLMihgdnVzhE361
    © 2001-2024 Robert Hashemian   Powered by