使用javascript和json捕获用户ip地址 [英] Capturing user ip address using javascript and json

查看:78
本文介绍了使用javascript和json捕获用户ip地址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello All

I am trying to capture an user computer IP address using java-script and json. I am always getting public IP or server IP but not local IP. can you please help me if anyone come across this.

Thanks in advance





我尝试了什么:



我试过Request.ServerVariables [Remote_Addr]给服务器ip并尝试了json url来获取ip但它是给公众ip



What I have tried:

I tried Request.ServerVariables["Remote_Addr"] is giving server ip and tried json url to get ip but it is giving the public ip

推荐答案

你可以查看这个链接:



http:// www。 codeproject.com/Questions/798310/How-to-get-local-ip-address-using-javascript
you can check this link out:

http://www.codeproject.com/Questions/798310/How-to-get-local-ip-address-using-javascript


某些代理服务器可能包含此信息转发 [ ^ ]或 X-Forwarded-For [< a href =https://en.wikipedia.org/wiki/X-Forwarded-Fortarget =_ blanktitle =New Window> ^ ]标题。但是,大多数都没有,而且这些信息很容易伪造。



在大多数情况下,本地IP地址不会离开本地局域网,而且会毫无意义在本地局域网之外。
Some proxy servers might include this information in either the Forwarded[^] or X-Forwarded-For[^] headers. However, most do not, and this information is easy to forge.

For the most part, the local IP address does not leave the local LAN, and would be meaningless outside of the local LAN.


这篇关于使用javascript和json捕获用户ip地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆