Question:
How can I get my local IP address using JavaScript?
anonymous
2009-08-13 13:05:42 UTC
I'm using Selenium to drive a bunch of automated tests. One of those tests needs to know its own IP address behind our firewall. That means I can't use any external services or APIs. What I *can* do is inject JavaScript into the browser itself. Any ideas?
Six answers:
flybishop
2009-08-13 13:24:02 UTC
Javascript doesn't have direct access to ip information. You would have to hard code the ip information of that computer. Windows gets the dns information from the router and doesn't make that available to the browser directly.



you can get that info from the command prompt by typing ipconfig
cmeinco
2009-08-20 18:46:48 UTC
If you're testing a service running locally on the machine running the tests, then use the loopback ip address (127.0.0.1) instead of the ip received from your dhcp/assigned. If you are submitting that data to some form or something.... that doesn't make sense, the service can retrieve the remote ip address, modify your server side if possible.
anonymous
2009-08-13 20:19:07 UTC




















Free JavaScripts provided


by The JavaScript Source






anonymous
2009-08-21 06:06:05 UTC
I tried my level best & Found out the information in this page

http://bytes.com/topic/javascript/answers/90998-can-i-get-my-local-ip-address-javascript-under-ie



I think it will help for my Friend who asked the above question..



If you have Doubt after Get the Ip-Address Check out your Ip-Address here using the site http://www.ip-details.com/domain-host-search/
Miha L
2009-08-20 09:29:57 UTC
http://www.ipaddresslocation.org point to your internal and external IP address and also your MAC address. Try it.
A guy with too much time
2009-08-13 20:16:22 UTC
i hope this help.

http://www.devguru.com/technologies/javascript/11192.asp



if not, heres a good starting point.

http://www.google.com/search?hl=en&q=getting+the+IP+address+using+javascript


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...