|
| 1 | +--- |
| 2 | +title: What is my IP? |
| 3 | +description: Show your IP |
| 4 | +date: 2025-03-05T22:51:41.132Z |
| 5 | +tags: |
| 6 | + - networking |
| 7 | + - technology |
| 8 | +categories: |
| 9 | + - tools |
| 10 | + - web |
| 11 | +math: false |
| 12 | +--- |
| 13 | + |
| 14 | +<!DOCTYPE html> |
| 15 | +<html lang="en"> |
| 16 | +<head> |
| 17 | + <meta charset="UTF-8"> |
| 18 | + <meta name="viewport" content="width=device-width, initial-scale=1.0"> |
| 19 | + <title>{{ page.title }}</title> |
| 20 | + <script> |
| 21 | + async function fetchIP() { |
| 22 | + try { |
| 23 | + let ipv4 = await fetch("https://api64.ipify.org?format=json").then(res => res.json()); |
| 24 | + let ipv6 = await fetch("https://api6.ipify.org?format=json").then(res => res.json()); |
| 25 | + document.getElementById("ipv4").textContent = ipv4.ip; |
| 26 | + document.getElementById("ipv6").textContent = ipv6.ip; |
| 27 | + } catch (error) { |
| 28 | + console.error("Error fetching IP:", error); |
| 29 | + document.getElementById("ipv4").textContent = "Error fetching IPv4"; |
| 30 | + document.getElementById("ipv6").textContent = "Error fetching IPv6"; |
| 31 | + } |
| 32 | + } |
| 33 | + </script> |
| 34 | + <style> |
| 35 | + body { |
| 36 | + font-family: Arial, sans-serif; |
| 37 | + text-align: center; |
| 38 | + background: linear-gradient(135deg, #667eea, #764ba2); |
| 39 | + color: white; |
| 40 | + padding: 20px; |
| 41 | + } |
| 42 | + .container { |
| 43 | + margin-top: 50px; |
| 44 | + background: rgba(255, 255, 255, 0.2); |
| 45 | + padding: 20px; |
| 46 | + border-radius: 10px; |
| 47 | + box-shadow: 0 0 10px rgba(0, 0, 0, 0.2); |
| 48 | + display: inline-block; |
| 49 | + } |
| 50 | + h1 { |
| 51 | + font-size: 2em; |
| 52 | + } |
| 53 | + p { |
| 54 | + font-size: 1.5em; |
| 55 | + } |
| 56 | + </style> |
| 57 | +</head> |
| 58 | +<body onload="fetchIP()"> |
| 59 | + <div class="container"> |
| 60 | + <h1>Your IP Addresses</h1> |
| 61 | + <p><strong>IPv4:</strong> <span id="ipv4">Loading...</span></p> |
| 62 | + <p><strong>IPv6:</strong> <span id="ipv6">Loading...</span></p> |
| 63 | + </div> |
| 64 | +</body> |
| 65 | +</html> |
0 commit comments