myip.coffee/script.js
Kumi 81ac90c68e
feat: Launch MyIP.Coffee web service
Introduced a new web service, MyIP.Coffee, for displaying client IP addresses. This update includes:
- MIT License addition for open-source usage.
- README for setup instructions and project overview.
- PHP script and nginx configs to support IP address retrieval.
- Basic website structure with HTML, CSS, and JavaScript to display IPv4 and IPv6 addresses on load.

This service aims to provide a user-friendly platform for clients to easily find their public IP addresses, supporting both IPv4 and IPv6 with a focus on simplicity and efficiency. Future improvements may include enhanced IP detection and custom user settings.
2024-04-12 19:52:23 +02:00

21 lines
No EOL
659 B
JavaScript

function getMyIP() {
fetch('https://ipv4.myip.coffee')
.then(response => response.text())
.then(ipv4 => document.getElementById('ipv4').textContent = ipv4)
.catch(err => {
console.log(err);
document.getElementById('ipv6').textContent = `Not available!`
});
fetch('https://ipv6.myip.coffee')
.then(response => response.text())
.then(ipv6 => document.getElementById('ipv6').textContent = ipv6)
.catch(err => {
console.log(err);
document.getElementById('ipv6').textContent = `Not available!`
});
}
document.addEventListener('DOMContentLoaded', () => {
getMyIP();
});