0

I am building a Chrome extension to (hopefully) display the Windows Username when that person clicks the icon.

I see in Chrome when I visit chrome://version/ that there is a Profile Path which displays my username. Is it possible to use Javascript to open this file & read this profile path into a variable?

Here's my current code so far:

document.getElementById("username").value="mcgurk";
document.getElementById("password").value="*****";
document.getElementById("logon_button").click();
halfer
  • 19,824
  • 17
  • 99
  • 186
michaelmcgurk
  • 6,367
  • 23
  • 94
  • 190
  • 1
    You can't read user files with JavaScript at will. This would be huge security issue. You can only ask user politely to upload right files via input field manually so you can use them. – JoannaFalkowska Sep 12 '16 at 09:11
  • @Senthe Thanks for this. If I can't read user files, is it possible to get the `Profile Path` like I can get the `User Agent`? – michaelmcgurk Sep 12 '16 at 09:12
  • 1
    I may be wrong, but I don't think it's possible either. – JoannaFalkowska Sep 12 '16 at 09:20
  • @Senthe Appreciate the help. I'm starting to think that too :) – michaelmcgurk Sep 12 '16 at 09:21
  • 1
    Possible duplicate of [JavaScript - How to get the name of the current user](http://stackoverflow.com/questions/9518092/javascript-how-to-get-the-name-of-the-current-user) – Mr_Green Sep 12 '16 at 10:18
  • @Mr_Green `JavaScript will not be able to determine your Windows user name.`. I'm going to try find a workaround with Chrome Extension. Will add my answer here if I get that far :-D – michaelmcgurk Sep 12 '16 at 10:24
  • @michaelmcgurk sure :) – Mr_Green Sep 12 '16 at 10:43
  • I would not look at JS API, but Chrome extensions API. Could you try this out ? Seems not to answer your need but it may help you hopefully : https://developer.chrome.com/extensions/signedInDevices –  Mar 07 '20 at 12:12

1 Answers1

0

After much research, it is not possible to read the Profile Path variable.

michaelmcgurk
  • 6,367
  • 23
  • 94
  • 190