/    Sign up×
Community /Pin to ProfileBookmark

HTML – Script – Looking to capture User Name

Hello…I am hoping this can be done using JS or VBScript.

I want to capture the value in the windows username environment variable.

Does anyone know if this is possible?

Thanks!

to post a comment
JavaScript

6 Comments(s)

Copy linkTweet thisAlerts:
@toicontienJun 13.2007 — Hm. This sounds like the seed of a huge browser security flaw. The ONLY way this [I]might[/I] work is if you use ActiveX, which means your script will be Internet Explorer-only. You could try searching the Microsoft Developers Network.

I'm betting you can't do that. That's a HUGE security no-no.
Copy linkTweet thisAlerts:
@jeffcravenerauthorJun 13.2007 — that would suck. haha....I use VB .NET and can grab the username pretty easily....so I was hoping the same thing can be done in HTML, or with a script in HTML.

It's for an intranet site within our company, and we only use IE, so that would be fine. I will check the link.

What i am trying to do, is we have a website we have for reporting issues with certain things, and it generates and e-mail. And ?I want the email to come from the person who is filling out and submitting the form.

Thanks!
Copy linkTweet thisAlerts:
@slaughtersJun 13.2007 — Then what is the problem?

Use VB/Net to gab the user name and shove it in a variable called username.

Show the variables value on the HTML page with a <%=username%>
Copy linkTweet thisAlerts:
@toicontienJun 13.2007 — Yeah, something like:
&lt;script type="text/javascript"&gt;
var username = "&lt;%=username%&gt;";
&lt;/script&gt;

That way you're not having the browser hack into the OS.
Copy linkTweet thisAlerts:
@jeffcravenerauthorJun 13.2007 — awesome! thats exactly what i was looking for!

The webpages we use are not built with VB .NET (asp), only using HTML with some Java scripting...I was just saying in VB .NET i know how to grab the username, so was hoping there was a way in HTML or javascript.

I'll give your code a shot...thanks!
Copy linkTweet thisAlerts:
@jeffcravenerauthorJun 13.2007 — OHH..i see what ur saying...if i was using VB .NET in the background for this HTML page, i could do the above....gotcha. Unfortunately, only allowed to use some java or VB script.
×

Success!

Help @jeffcravener spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.4,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...