1

The Scenario

I'm asking this question because I know from using Node.js you can use this code to pull user information from the operating system.

console.log(userInfo());

Question

Is there a way that you could get this information from a hosted website that's hosted on an Apache server?

Or, can JavaScript get this information outside of using Node.js?

Edit

Sorry I didn't make this exactly clear, I want specifically the user information not just the OS, so for example on windows you can have multiple user accounts i wanted the username for the current account. The current answer and duplication links all lead to getting the operating system information but not the currently logged in users name.

Kenziiee Flavius
  • 1,686
  • 4
  • 22
  • 50
  • Yes, you can in window.navigator.appVersion – DanteTheSmith Dec 19 '17 at 18:10
  • 1
    @DanteTheSmith that has been dropped from the standards. From MDN: "this feature has been removed from the Web standards. Though some browsers may still support it, it is in the process of being dropped. Avoid using it and update existing code if possible; see the compatibility table at the bottom of this page to guide your decision. Be aware that this feature may cease to work at any time." –  Dec 19 '17 at 18:11
  • @Amy Goot to know, TY – DanteTheSmith Dec 19 '17 at 18:13

1 Answers1

1

Maybe you can use ua-parser-js to identify the OS in the browser

https://github.com/faisalman/ua-parser-js

from the documentation

getOS()
returns { name: '', version: '' }
# Possible 'os.name'
AIX, Amiga OS, Android, Arch, Bada, BeOS, BlackBerry, CentOS, Chromium OS, Contiki,
Fedora, Firefox OS, FreeBSD, Debian, DragonFly, Gentoo, GNU, Haiku, Hurd, iOS, 
Joli, Linpus, Linux, Mac OS, Mageia, Mandriva, MeeGo, Minix, Mint, Morph OS, NetBSD, 
Nintendo, OpenBSD, OpenVMS, OS/2, Palm, PC-BSD, PCLinuxOS, Plan9, Playstation, QNX, RedHat, 
RIM Tablet OS, RISC OS, Sailfish, Series40, Slackware, Solaris, SUSE, Symbian, Tizen, 
Ubuntu, UNIX, VectorLinux, WebOS, Windows [Phone/Mobile], Zenwalk

# 'os.version' determined dynamically
JuanCrg90
  • 1,006
  • 14
  • 24