반응형
<div>
<style>
body { font-family: Arial, sans-serif; margin: 40px; }
#ip-box { font-size: 1.5em; color: #0074D9; margin-top: 20px; }
</style>
</div>
<div id="ip-box">IP 주소를 불러오는 중...</div>
<script>
fetch('https://api.ipify.org?format=json')
.then(response => response.json())
.then(data => {
document.getElementById('ip-box').textContent = 'IP: ' + data.ip;
})
.catch(() => {
document.getElementById('ip-box').textContent = 'IP 주소를 불러올 수 없습니다.';
});
</script>
반응형