-3

By using below code i am able to get client ip address, but i want to get client ip in js without using any external http:// or https:// url,

how do i get client ip address?

$.getJSON("http://jsonip.com?callback=?", function (data) {
    alert("Your ip: " + data.ip);
});

java is server side language. Please help me.

shas
  • 678
  • 2
  • 8
  • 26
  • 1
    Given your existing code, it looks like your question is "Can you recommend a service that will tell me the client IP over SSL?", and product recommendation questions are off-topic for Stackoverflow. – Quentin Feb 04 '15 at 09:57
  • i need over the ssl url site.. can u tell me.. – shas Feb 04 '15 at 10:03
  • I just said it was off-topic for this site, so no. – Quentin Feb 04 '15 at 10:04

1 Answers1

0

Have a server side page on your site return the IP address, you don't want to be making external calls, especially to http otherwise you'll get browser warnings.

$.getJSON("getIPFromThisJSONPage.aspx", function (data) {
    alert("Your ip: " + data.ip);
});

OR

$.get("getIPFromThisAjaxPage.aspx",function(data){
    return data;
});

You don't mention what your using as a server side language so not much point in providing an example - besides ajax/json examples are a dime a dozen :)

Hugo Yates
  • 2,046
  • 2
  • 25
  • 24