获取客户端Windows的用户名 [英] Get client windows username

查看:164
本文介绍了获取客户端Windows的用户名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我能得到的使用小程序的人目前looged的用户名。如果是的话,我怎么能使用小程序在我的动态Web项目?
我知道,我们即可以这样做。

Can i get the username of the currently looged in person using applets. If yes, how can i use the applet in my dynamic web project? I know in I.E we can do like this

var objUserInfo = new ActiveXObject("WScript.network");
document.write(objUserInfo.ComputerName+"<br>"); 
document.write(objUserInfo.UserDomain+"<br>"); 
document.write(objUserInfo.UserName+"<br>");  
var uname =  objUserInfo.UserName;
alert(uname);

但我使用的小程序,以便它会在任何浏览器的工作需要。

but i want it using applet so that it will work in any browser.

推荐答案

请注意,这实际上是在规避浏览器安全的一种尝试。
看看这个问题的答案类似(但不excactly一样)的问题。
HTTP://www.$c$cranch .COM / T / 243316 /小程序/ JAVA / Windows的NT-登录的小程序

Be aware that this is in fact an attempt to circumvent the browser security. look at the answer to this similar (but not excactly the same) question. http://www.coderanch.com/t/243316/Applets/java/windows-NT-login-applet


  • 的ActiveX 将无法在Chrome / Firefox的正常运行。

  • 的JavaScript 不会(由于安全原因)让你得到从操作系统的信息。

  • 闪存是跨浏览器,可用于这一点,但很难避开铬合金的沙箱。

  • ActiveX will not run properly in Chrome / Firefox.
  • Javascript won't (due to security reasons) allow you to get that information from the operating system.
  • Flash is cross browser, and can be used for this, but it is difficult to get around chromes sandbox.

所以我的建议是最好的的Java

so my best suggestion is java.

下面是关于为什么你不能回答没有一个applet类似的问题。
<一href=\"http://security.stackexchange.com/questions/36728/can-your-windows-or-linux-username-be-exposed-to-websites\">http://security.stackexchange.com/questions/36728/can-your-windows-or-linux-username-be-exposed-to-websites

Here is a similar question that is answered on why you can't without an applet. http://security.stackexchange.com/questions/36728/can-your-windows-or-linux-username-be-exposed-to-websites

和从回答另一个类似的问题指向一个Java解决方案所提供的链接,但也有限制的成功:
http://www.rgagnon.com/javadetails/java-0441.html

And the provided link from an answer to another similar question points to a java solution, but there are limits to the success: http://www.rgagnon.com/javadetails/java-0441.html

不过,我想你应该从那里开始,然后在这里发表一个解决方案时,它的工作原理;)

However I think you should start from there, and then post a solution here when it works ;)

在这里看到的问题是,当小程序会尝试与本地资源交互的浏览器必须允许它,或者阻止它..
在IE的安全设置,可以prevent,如果设置为高,和铬合金沙箱阻止它,如果你这样做不对。我不知道与Firefox或Safari的问题,但我猜你会发现他们在测试时...

See the problem here is that when the applet tries to interact with local resources the browser must allow it, or block it.. Security settings in IE, may prevent that if set to high, and Chromes sandbox may block it if you do it wrong. I don't know of problems with Firefox or Safari, but I guess you'll find them when testing...

祝你好运。

这篇关于获取客户端Windows的用户名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆