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.
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.
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));
});