How do I get the machine name via javascript?

Asked

Viewed 1,016 times

-1

Hello, I would like to get the name of the user’s machine that is accessing my application.. How can I do this by javascript?

<script type="text/javascript">
    function nomepc(){
        var net = new ActiveXObject("wscript.network");
        alert(net.UserDomain + ': ' + net.ComputerName);
    }
</script>
  • are using nodejs ? because this has a function that allows you to do this

  • 1

    This command only works in IE, and not all versions. The machine name cannot be obtained by the client.

  • 1

    @Scrapbench, How can I do in nodejs? you have some example?

1 answer

0

    require('dns').reverse(req.connection.remoteAddress', function(err, domains) {

    console.log(domains);
});

To follow up the comment of the question using this function your server will do a DNS reset and in principle should work

Browser other questions tagged

You are not signed in. Login or sign up in order to post.