利用下面代码,即可获取访客所在的城市
<!DOCTYPE html> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <body> <p>你的地址: <script src="https://pv.sohu.com/cityjson?ie=utf-8"></script> <script>document.write(returnCitySN["cname"])</script> </p> </body> </html>