Get ip and user machine name [closed]

0

I need to get the ip and username of the user with javascript because it is a local html and css page and is shared with the users of the network.

    
asked by anonymous 04.07.2017 / 18:01

1 answer

1

To get the hostname is simple, just use the window class, but to get the ip address it is necessary to request an http request for some service that answers that IP or a cloud service that does that work like freegeoip.net.

Get the host name: window.location.host

Example in jquery to frazer a requiem and get ip:

$.getJSON( "//freegeoip.net/json/", function(data) {
      console.info(JSON.stringify(data));
});
    
04.07.2017 / 18:14