1/新浪定位
<script src="http://int.dpool.sina.com.cn/iplookup/iplookup.php?format=js"></script>
var city = remote_ip_info['city'];
alert(city);
2/百度ip定位
var _script = document.createElement('script');
_script.type = "text/javascript";
_key = ""; //百度地图可以申请到
_script.src = "https://api.map.baidu.com/location/ip?ak=" + _key + "&coor=bd09ll&callback=citycallback"; //拼接URL
document.head.appendChild(_script);
function citycallback(data) {
console.log(data);
}