Spaces:
Running
Running
Srinivasulu kethanaboina commited on
Update index.html
Browse files- index.html +25 -18
index.html
CHANGED
|
@@ -1,19 +1,26 @@
|
|
| 1 |
-
<!
|
| 2 |
-
<html>
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
</html>
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>Public IP Address</title>
|
| 7 |
+
</head>
|
| 8 |
+
<body>
|
| 9 |
+
<h1>Your Public IP Address</h1>
|
| 10 |
+
<p id="ip-address">Loading...</p>
|
| 11 |
+
|
| 12 |
+
<script>
|
| 13 |
+
async function fetchPublicIP() {
|
| 14 |
+
try {
|
| 15 |
+
const response = await fetch('https://api.ipify.org?format=json');
|
| 16 |
+
const data = await response.json();
|
| 17 |
+
document.getElementById('ip-address').textContent = data.ip;
|
| 18 |
+
} catch (error) {
|
| 19 |
+
document.getElementById('ip-address').textContent = 'Unable to retrieve IP address';
|
| 20 |
+
}
|
| 21 |
+
}
|
| 22 |
+
|
| 23 |
+
fetchPublicIP();
|
| 24 |
+
</script>
|
| 25 |
+
</body>
|
| 26 |
</html>
|