js(jquery)得到用户真实ip
由于静态页面只能用脚本 希望js不只是针对ie 得到ip后 怎么算出他在哪个城市呢..谢谢啦 不想写的话 告诉思路也行..实在想不出来了 --------------------编程问答-------------------- This question gave me an itch, so I put up a JSONP webservice on Google App Engine that returns the clients ip address. Usage:<script type="application/javascript">
function getip(json){
alert(json.ip); // alerts the ip address
}
</script>
<script type="application/javascript" src="http://jsonip.appspot.com/?callback=getip"> </script>
Yay, no server proxies needed.
来自
http://stackoverflow.com/questions/102605/can-i-lookup-the-ip-address-of-a-hostname-from-javascript --------------------编程问答--------------------
<html>
<head>
<title></title>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.4.2.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#cz88").load("http://www.cz88.net/ip/viewip468_25_utf8.aspx");
$("#cz88").ajaxStop(function(){
var ip = $("#cz88 #AddrMessage").text();
alert(ip);
})
})
</script>
</head>
<body>
<div id="cz88" style="display:none;"></div>
</body>
</html>
补充:.NET技术 , C#