Meta Game Help: Reading Logged-in user's name.

I'm currently planning on making an extremely meta horror game in RPG Maker MV that takes place inside of a world that knows that completely knows that a world beyond their world exists, and that world is currently collapsing due to an unknown event. As far as I know so far, it's going to be lovecraftian horror mixed with a few RPG elements.

So to start off, I was wondering if there was any way if I could have the game read the logged-in user's name? I know Oneshot did it before, but that was in RPG Maker MV. I've searched around, but I can't find out how to do it, since RPGMV runs in Javascript, and as far as I can tell, it can't read the user's info because it's a webpage. A site I read said that I need to have some kind of AJAX server-side thingy, but I'm a complete noob at Javascript currently, and I have NO idea how to do that stuff.

Please, if anybody can help, it'd be greatly appreciated. ^^
First question: Logged-in where?

If you're talking about logging in to a webserver, then you basically need to provide access to that webservers database and it can easily done by javascript, as that is one of the javascripts main purposes.

If you're talking about a local game accessing the local computer's username, then that is something different - there are HTML/javascript elements that can be used to access that data, but only if the privacy settings on the browser and computer allow that. If the player has set those too high then you can't do it.
Theoretically it is possible to do by providing your own dll and accessing it through windows commands, but that means that your game will become windows-only.
Yeah, local game is what I'm talking about... Buuut yeah, I did read that the commands on there can't be used if the browser privacy is too high.

If I can't find another way to do it, then I might have to do the dll solution... It'll make the game unable to be played on Mac, but I'm sure it won't harm much... I think.
You can gamble on the player putting the game somewhere in their user folder, and find what the username is from that.

Both Macintosh and Windows will format the directory names with "/Users/[Username]" or "\Users\[Username]". Try parsing
Code:
nw.__dirname
It's easy if it's a desktop game, you can use the OS module:
https://nodejs.org/docs/latest-v9.x/api/os.html

Code:
const { username } = require('os').userInfo()
$gameVariables.setValue(1, username)
alert(`Hello, ${$gameVariables.value(1)} !`)
This code is assuming you're running the latest version of MV (v1.6.2)

Original thread: https://forums.rpgmakerweb.com/threads/meta-game-help-reading-logged-in-users-name.112290/