I want to find client's IP Address when accessing my app..How to find using javascript code..kindly provide help with sample code..I tried wit tis code but m not getting
function getip(json){ alert(json.ip); // alerts the ip address }
I want to find client's IP Address when accessing my app..How to find using javascript code..kindly provide help with sample code..I tried wit tis code but m not getting
function getip(json){ alert(json.ip); // alerts the ip address }
You can't using ONLY JavaScript on it's own. You need to use a server side script ans call it using Ajax to perform this task.
For example in PHP script, you can do the following to get the client's ip address:
echo $_SERVER["REMOTE_ADDR"];
Next call this script using Ajax and display/use it in your page.
At least there used to be a way using Java to do this, but Javascript alone cannot find a machines IP.