admin管理员组

文章数量:1410705

I want to obtain the remote client ip by javascript, not querying any external ip resource pools. how could i get the remote ip address, just like the way i get appName by navigator.appName

also like the ways as follows:

PHP:<?php echo $_SERVER["REMOTE_ADDR"]; ?>

NODE.JS: req.connection.remoteAddress

so green with javascript, and im trying to google with some keywords. yet i still can't find the result i want. any guy here could share his solution of the same desired scene? any tips or suggestions are wele.

platform:chrome, firefox

I want to obtain the remote client ip by javascript, not querying any external ip resource pools. how could i get the remote ip address, just like the way i get appName by navigator.appName

also like the ways as follows:

PHP:<?php echo $_SERVER["REMOTE_ADDR"]; ?>

NODE.JS: req.connection.remoteAddress

so green with javascript, and im trying to google with some keywords. yet i still can't find the result i want. any guy here could share his solution of the same desired scene? any tips or suggestions are wele.

platform:chrome, firefox

Share Improve this question edited Apr 19, 2013 at 14:27 Emil Ivanov 37.7k12 gold badges76 silver badges91 bronze badges asked Apr 19, 2013 at 14:19 Yi LingYi Ling 2873 silver badges11 bronze badges 2
  • possible duplicate of Get Client IP using just Javascript? – Ian Commented Apr 19, 2013 at 14:44
  • yeap, the same problem(i had read it). but so pity the answers cannot help yet. thanks @Ian. – Yi Ling Commented Apr 19, 2013 at 14:54
Add a ment  | 

2 Answers 2

Reset to default 3

You can't know it on the client because the client doesn't know it. For example, if the client is behind a NAT, the IP of the machine will be different from the IP the "world" sees.

Make a simple server (AJAX) call that will return you the remote address.

This is not possible using pure Javascript without external calls.

本文标签: user agenthow to get browser39s remote ip by javascriptStack Overflow