admin管理员组文章数量:1293239
Example:
<script type = "text/JavaScript">
try
{
var ax = new ActiveXObject("WScript.Network");
document.write('User: ' + ax.UserName + '<br />');
document.write('Computer: ' + ax.ComputerName + '<br />');
}
catch (e)
{
document.write('Permission to access puter name is denied' + '<br />');
}
</Script>
Actually I am Getting the Following output:
Permission to access puter name is denied
Please help to get Client Machine Computer name using jquery / Javascript (Php).
Example:
<script type = "text/JavaScript">
try
{
var ax = new ActiveXObject("WScript.Network");
document.write('User: ' + ax.UserName + '<br />');
document.write('Computer: ' + ax.ComputerName + '<br />');
}
catch (e)
{
document.write('Permission to access puter name is denied' + '<br />');
}
</Script>
Actually I am Getting the Following output:
Permission to access puter name is denied
Please help to get Client Machine Computer name using jquery / Javascript (Php).
Share Improve this question edited Jan 20, 2016 at 21:39 patricksweeney 4,0227 gold badges44 silver badges56 bronze badges asked Dec 17, 2015 at 6:41 Dinesh GDinesh G 1,3655 gold badges17 silver badges24 bronze badges3 Answers
Reset to default 4The problem is explained in the following Link. They say it is (in most cases) impossible to do.
However, if you are making an internal application you can 'register' each puter to a database and save the putername and IP. And then you can later use the IP of the host to determine the hostname by querying it to the database.
ActiveX is a Microsoft-proprietary framework.Your code works only in IE. In other browsers ActiveXObject really does not exist. You will get an error like this,
Uncaught ReferenceError: ActiveXObject is not defined
var network = new ActiveXObject('WScript.Network');
// Show a pop up if it works
alert(network.puterName);
本文标签: How to get computer name using javascript WScriptNetworkStack Overflow
版权声明:本文标题:How to get computer name using javascript WScript.Network? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741567634a2385818.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论