外部サービスに依存するが
ipinfoを使う方法
fetch('https://ipinfo.io?callback') .then(res => res.json()) .then(json => console.log(json.ip))
ipifyを使う方法
fetch('https://api.ipify.org?format=json') .then(res => res.json()) .then(json => console.log(json.ip))
外部サービスに依存するが
ipinfoを使う方法
fetch('https://ipinfo.io?callback') .then(res => res.json()) .then(json => console.log(json.ip))
ipifyを使う方法
fetch('https://api.ipify.org?format=json') .then(res => res.json()) .then(json => console.log(json.ip))