

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
JavaScript program to retrieve clients IP address
Following is the code for retrieving clients IP address −
Example
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title>Document</title> <style> body { font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif; } .result { font-weight: 500; font-size: 18px; color: blueviolet; } </style> </head> <body> <h1>Retrieve clients IP address</h1> <div class="result"></div> <script type="application/javascript"> let resEle = document.querySelector(".result"); function showIP(json) { resEle.innerHTML = "My public IP address is: " + json.ip; } </script> <script type="application/javascript" src="http://ipinfo.io/?format=jsonp&callback=showIP"></script> </body> </html>
Output
- Related Questions & Answers
- C Program to validate an IP address
- Difference between Static IP Address and Dynamic IP Address
- C# program to Display Hostname and IP address
- Python program to Display Hostname and IP address?
- C Program to display hostname and IP address
- Program to display hostname and IP address C
- Java program to display Hostname and IP address
- Program to convert IP address to hexadecimal in C++
- Java program to convert Byte array to IP Address
- Alias/Secondary IP Address
- Difference between MAC Address and IP Address
- Difference between IP Address and MAC Address
- Java program to Get IP address of the system
- C# program to find IP Address of the client
- Java program to find IP Address of the client
Advertisements