fetch('https://ipinfo.io/json')
            .then(response => response.json())
            .then(data => {
                console.log('ip归属地:', data);
            })
            .catch(error => {
                console.error('获取ip归属地失败:', error);
            });