JS获取IP 及地区等信息
腾讯的ip开放接口(gbk)
< script language = "javascript" type = "text/javascript" src = "http://fw.qq.com/ipaddress" ></ script > |
2 | < script >document.write("你的IP是:"+IPData[0]+",来自:"+IPData[2]);</ script > |
这个接口返回的是json格式的数据(utf8)
< script language = "javascript" type = "text/javascript" src = "http://int.dpool.sina.com.cn/iplookup/iplookup.php?format=js" ></ script > |
2 | < script type = "text/javascript" >document.write("欢迎来自:"+remote_ip_info.country+remote_ip_info.province+remote_ip_info.city+"的朋友!"); |
3 |
4 | </ script > |