diff --git a/script.js b/script.js index 9f4af3b..bb0c5d8 100644 --- a/script.js +++ b/script.js @@ -1,5 +1,7 @@ function getMyIP() { - fetch('https://ipv4.myip.coffee') + const domain = window.location.hostname.replace(/^www\./, ''); + + fetch('https://ipv4.' + domain) .then(response => response.text()) .then(ipv4 => document.getElementById('ipv4').textContent = ipv4) .catch(err => { @@ -7,7 +9,7 @@ function getMyIP() { document.getElementById('ipv6').textContent = `Not available!` }); - fetch('https://ipv6.myip.coffee') + fetch('https://ipv6.' + domain) .then(response => response.text()) .then(ipv6 => document.getElementById('ipv6').textContent = ipv6) .catch(err => {