Get client windows username

后端 未结 1 1305
猫巷女王i
猫巷女王i 2021-01-27 17:10

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

<         


        
1条回答
  •  生来不讨喜
    2021-01-27 17:34

    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 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.

    so my best suggestion is java.

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

    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 ;)

    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...

    Good luck.

    0 讨论(0)
提交回复
热议问题