1

I want to get the computer name using jquery. I tried using ActiveX Object but it will only run on IE browser. Is there is another way to get the computer name using jquery. I tried that code.

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

Can u any one help me..

6
  • Even on that navigator it will probably be blocked on mostly computers. I don't think you would get that information without client extended code. Also define what you expect by computer name, host name, Wins name, etc. Commented Oct 10, 2017 at 3:59
  • 2
    no, there is no way a browser can access the underlying operating system like that at all Commented Oct 10, 2017 at 4:00
  • @guest271314 cleary if the user is already showing a solution for IE he is not working on a Firefox/Chrome extension. Commented Oct 10, 2017 at 4:14
  • @SamuelNeff You are ignoring "I tried using ActiveX Object but it will only run on IE browser." OP is asking how the procedure can be accomplished, and used ie as an example of a browser accessing the local filesysystem or a shell. Commented Oct 10, 2017 at 4:16
  • @SamuelNeff NativeMessaging is available at edge browser learn.microsoft.com/en-us/microsoft-edge/extensions/guides/… Commented Oct 10, 2017 at 4:44

2 Answers 2

3

You can't. This information is not available to web sites.

The ActiveX approach outlined in your question won't even work in current versions of Internet Explorer, as the WScript.Network ActiveX object is not marked as safe for scripting.

Sign up to request clarification or add additional context in comments.

9 Comments

The requirement is possible using NativeMessaging
@guest271314 That would involve installing a browser extension and/or a native application on the user's computer, which isn't something that a web site can do on its own.
"You can't" is not accurate as to the requirement. Protocol handler could also be utilized.
@guest271314 The implication is that the OP wants a method that will work in a "stock" web browser, without requiring the user to change browser security settings or install additional software / addons.
@guest271314 the default for any question about the web, jquery, javascript would be in a browser unless specified otherwise. Your insistence that this is possible without clearly qualifying it "within an extension" is not helpful.
|
-1

Is there is another way to get the computer name

You can utilize NativeMessaging to achieve requirement at Firefox and Chromium, Chrome.

4 Comments

This is only applicable for an extension. It cannot be used from a web page.
@SamuelNeff "This is only applicable for an extension. It cannot be used from a web page" That is not correct. An extension can communicate with a web page. "used from a web page" does not appear at Question.
Web page is very clearly the context of the question.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.