title: Jquery Get Local pc ip address and check administrator
body: <p>in my organization all http sites are blocked
  and i want ip address and to check administrator if not then logout in sharepoint.
  I am using <a href="http://ipinfo.io" rel="nofollow">http://ipinfo.io</a> to fetch ip address. but now this is blocked and when i am using <a href="https://ipinfo.io" rel="nofollow">https://ipinfo.io</a> it is giving me server ip not my local pc ip.
  Any help would be appreciated.</p>
  
  <pre><code>var IPCollections = "192.168.1.29"; // Add ips here
  $.ajax
       ({
           url: "/_api/web/CurrentUser?$select=Title",
           method: "GET",
           async: false,
           headers: {
               "accept": "application/json;odata=verbose",
               "content-type": "application/json;odata=verbose",
               "X-RequestDigest": $("#__REQUESTDIGEST").val()
           },
           success: function (data) {
               try {
                   if (data.d.Title == "superuser" || data.d.Title == "Super Admin") {
                       $.get("http://ipinfo.io", function (response) {
                           var Ip = response.ip;
                           console.log(Ip);
                           var arrycoll = IPCollections.split(',');
                           var keeplogin = false;
                           for (var i = 0; i &lt; arrycoll.length; i++) {
  
                               if (Ip == arrycoll[i]) {
                                   keeplogin = true;
                               }
                           }
                           if (!keeplogin) {
                               window.location.href = "/_layouts/SignOut.aspx";
                           }
  
                       },"jsonp");
                   }
               } catch (err) { }
           },
           error: function () {
           }
       });
  </code></pre>