Detecting the current IP through chrome extension?
问题 My Chrome extention needs to know what is the IP of the machine that it is running on (the real world IP) Is there a easy way of doing it? 回答1: You could always use the freegeoip service, one of my favorite implementations to pull it in is as follows: var geoip = function(data){ if (data.region_name.length > 0) { console.log('Your external IP:', data.ip); } } var el = document.createElement('script'); el.src = 'http://freegeoip.net/json/?callback=geoip'; document.body.appendChild(el); 回答2: