Created
June 5, 2024 08:00
-
-
Save remylagerweij/76888940b8379c08a12de62a34bd7c10 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async function getClientIp() { | |
try { | |
const response = await fetch('https://api.ipify.org?format=json'); | |
const data = await response.json(); | |
console.log(data.ip); | |
} catch (error) { | |
console.error('Error fetching the IP address:', error); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment