1

I want to find the client computer name. I am using php but it does not work well because it is server side language than I use javascript because it is client side.
I hava a code in javascript but it does not work.

 var network = new ActiveXObject('WScript.Network');  
   alert(network.computerName);  

Why this is not work please tell me.
If javascript can not do that then which language can do that.
Thanks.

Axeem
  • 670
  • 4
  • 16
  • 26
  • 1
    hope you have tried it in IE only? http://stackoverflow.com/questions/922476/how-can-i-read-the-clients-machine-computer-name-from-the-browser – Maz I Dec 19 '13 at 07:51
  • you tried [gethostname()](http://www.php.net/manual/en/function.gethostname.php) in PHP ? – skos Dec 19 '13 at 07:52
  • 2
    You can't really do it at all for a general public internet audience, period. – deceze Dec 19 '13 at 07:52
  • Seconding deceze, there's no straightforward/reliable way to do this on every computer. You'll need to come up with a different way to do it in each browser/platform. In many, it may just be unrealistic. You could try a Java-based solution (not JavaScript). – Zenexer Dec 19 '13 at 07:55

1 Answers1

1

@Sachyn Kosare, gethostname is for get local machine name, nor client machine name.

nowadays we will cannot get the client machine name by js due for security reasons and actually activex such as wscript needs clients permissions to run and i don't know if actual IE versions lets run it.

Néstor
  • 570
  • 2
  • 8
  • 22