File size: 764 Bytes
c2ac816
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a8b88dd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Public IP Address</title>
</head>
<body>
    <h1>Your Public IP Address</h1>
    <p id="ip-address">Loading...</p>

    <script>
        async function fetchPublicIP() {
            try {
                const response = await fetch('https://api.ipify.org?format=json');
                const data = await response.json();
                document.getElementById('ip-address').textContent = data.ip;
            } catch (error) {
                document.getElementById('ip-address').textContent = 'Unable to retrieve IP address';
            }
        }

        fetchPublicIP();
    </script>
</body>
</html>