Join WhatsApp ChannelJoin Now

How to Get IP Address using Javascript

Hi Dev,

Today, i we will show you how to get IP address using javascript. This article will give you simple example of how to get IP address using javascript. you will learn get how to get IP address using javascript. So let’s follow few step to create example of how to get IP address using javascript.

Example:

<!DOCTYPE html>
<html>
<head>
    <title>How to Get IP Address using Javascript</title>
</head>
<body>
    <h3>IP Address of user is:</h3> 
    <p style="color: red;"><strong id="ip"></strong></p> 
  
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
    <script type="text/javascript">

        $.getJSON("https://api.ipify.org?format=json", function(data) { 

            $("#ip").html(data.ip); 
            
        }) 

    </script> 
</body>
</html>

I hope it will assist you…

Recommended Posts