ruk·si

jQuery
Get IP Address

Updated at 2013-05-05 07:53

You can get user IP address easily by using jQuery and free APIs.

Browsers that support CORS, cross-origin request sharing. IE8+, Firefox, Chrome, Opera and most mobile browsers except Opera Mini.

$.get(
  'http://jsonip.com/',
  function(response) {
    console.log(response.ip);
  }
);

Older browser support with json-p

$.getJSON(
  'http://jsonip.com/?callback=?',
  function(response) {
    console.log(response.ip);
  }
);