[Javascript] Get Computer Name
Solved
DoulyCreations
Posted messages
265
Status
Membre
-
DoulyCreations Posted messages 265 Status Membre -
DoulyCreations Posted messages 265 Status Membre -
Hello,
I am looking to retrieve the client's computer name using JavaScript so that the code runs on the client side.
I managed to do it in PHP with the function:
The problem is that we want to execute this code on the client side and not the server side (for use outside of the intranet).
If you could guide me, our friend Google has not convinced me.
Thank you,
Best regards
Configuration: Windows XP / Firefox 7.0.1
--
Where there's a will, there's a way! Or not ...
I am looking to retrieve the client's computer name using JavaScript so that the code runs on the client side.
I managed to do it in PHP with the function:
<?php $num_pc = gethostbyaddr($_SERVER['REMOTE_ADDR']); // Retrieve the computer name based on the IP address ?>
The problem is that we want to execute this code on the client side and not the server side (for use outside of the intranet).
If you could guide me, our friend Google has not convinced me.
Thank you,
Best regards
Configuration: Windows XP / Firefox 7.0.1
--
Where there's a will, there's a way! Or not ...
2 réponses
not agree for that ....
I can accept the IP address but more, as you wish, would require accessing the configuration of the concerned PC and that .... THAT'S REALLY SKETCHY!!!
--
the 'www' is also meant to communicate, share and exchange, right?
thank you for having the courtesy to respond to those who are trying to help you
I can accept the IP address but more, as you wish, would require accessing the configuration of the concerned PC and that .... THAT'S REALLY SKETCHY!!!
--
the 'www' is also meant to communicate, share and exchange, right?
thank you for having the courtesy to respond to those who are trying to help you
Thank you for this comment.
I completely agree that in terms of security it opens a significant loophole.
But this retrieval is necessary for a project from my company, so I don't really have a choice.
I managed to retrieve the computer name using ActiveX:
The big problem is that it doesn't work in certain scenarios, such as when not going through the proxy, when not on Windows, etc...
Is there another way?
Best regards
--
Where there’s a will, there’s a way! Or not...
I completely agree that in terms of security it opens a significant loophole.
But this retrieval is necessary for a project from my company, so I don't really have a choice.
I managed to retrieve the computer name using ActiveX:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html> <head> <title>recup nom pc js</title> <script type="text/javascript"> function retourne_nompc() { var netw = new ActiveXObject("WScript.Network"); var nom_user = netw.UserName; var nom_domain_user = netw.UserDomain; var nom_pc = netw.ComputerName; return nom_pc; } </script> </head> <body> Nom du pc : <script type="text/javascript">document.write(retourne_nompc());</script> </body> </html> The big problem is that it doesn't work in certain scenarios, such as when not going through the proxy, when not on Windows, etc...
Is there another way?
Best regards
--
Where there’s a will, there’s a way! Or not...