var wwip=; $(function(){ $(document).ready( function() { $.getjson( http://smart-ip.net/geoip-json?callback=?, function(data){ alert( data.host); wwip=data.host; } ); }); });
这个问题查了很多资料,都不可以,这个还好用。
例子,js获取本地与外网ip地址。
以上是js获取本地ip地址的方法,下面来看js获取外网ip地址的例子。