jeudi 29 juin 2017

Get username from ActiveXObject("WScript.Network") not working?

I need a way to get a User's name from a web application that will be used in FireFox, Chrome, and IE. I have a javascript function in my code that is the onclick function for a button. The button is supposed to show an alert with the user's name. For some reason this is not working in my code. I am debugging in Visual Studio 2015, and I have opened VS as an administrator. I am attempting to run this code in Firefox and IE and nothing shows up. Is there another way to do this? Am I doing this wrong?

My HTML Code

<button onclick="getUser()">GET USER</button>
<script>
function getUser() {
    var net = new ActiveXObject("WScript.Network");
    alert(net.username);
}
</script>




Aucun commentaire:

Enregistrer un commentaire