最佳答案
我知道对这个问题的最初反应是“不”、“这不可能”和“你不应该需要它,你做错了”。我试图做的是得到用户的局域网 IP 地址,并显示在网页上。为什么?因为这就是我正在创作的网页的全部内容,尽可能多地展示关于你这个访问者的信息: Https://www.whatsmyip.org/more-info-about-you/
So I'm not actually DOING anything with the IP, other than showing it to the user for informational purposes. I used to do this by using a small Java applet. It worked pretty well. But these days, browser make you hit agree and trust so many times, to run even the most minor java applet, that I'd rather not run one at all.
所以有一段时间我没有使用这个特性,但是如果可能的话,我希望它能够恢复。作为一名计算机顾问,我时不时会用到它。进入这个网站查看网络运行的 IP 范围要比进入系统首选项、网络以及任何活动的接口都要快。
所以我想知道,希望,是否有某种方法可以单独使用 javascript?也许你可以访问一些新的对象,类似于 javascript 询问浏览器地理位置的方式。也许对于客户网络信息也有类似的东西?如果没有,也许还有其他完全不同的方法来做到这一点?我能想到的唯一方法是使用 java applet 或 flash 对象。这两件事我都不想做。