-3

By using below code I am able to get client IP address.

But I want to get client IP address in javascript without using any external website http:// or https:// urls.

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
  • 703
  • 2
  • 8
  • 31
  • 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,081
  • 2
  • 26
  • 24