Get Client IP with Javascript


Ever wondered how to get the client’s IP address from Javascript? I have to set it in a Cookie variable now, so here is what I found, a clean and easy solution:

<script type=”application/javascript”>

function get_my_ip(json){
alert(json.ip);
}
</script>
<script type=”application/javascript” src=”http://jsonip.appspot.com/?callback=get_my_ip”></script>
You can leave a response, or trackback from your own site.

Leave a Reply