In JavaScript, you can use the following script for getting the IP address.
var RTCPeerConnection = /*window.RTCPeerConnection ||*/ window.webkitRTCPeerConnection || window.mozRTCPeerConnection;if (RTCPeerConnection)(function() {var rtc = new RTCPeerConnection({iceServers: []});
How do I find the IP address of my browser?
Find your IP address
Open a web browser (such as Chrome, Firefox, or any browser of your choice).Go to one of the following websites or any similar website: whatsmyip.org. whatismyip.com. Either of these web pages detects and displays the public IP address of your network.
To get the client public IP address, JavaScript acts as a third party server-side language. JavaScript cannot do it alone so jQuery is added to do this. These are the application services that fetch the user IP address and simply return it in three formats, plain text, JSON and JSONP format.
How do I find my client IP?
Getting the Client IP Address
Use the system environment variable $_SERVER[“REMOTE_ADDR”] . One benefit is that on Pantheon this takes into account if the X-Forwarded-For header is sent in cases when a request is filtered by a proxy.Use Drupal’s ip_address() function.
How to get the local IP address in Python
hostname = socket. gethostname()local_ip = socket. gethostbyname(hostname)print(local_ip)