JavaScript and environment variables
Sep 12, 2013
Has anyone tried, or does anyone know of anyone that has success with, trying to grab the windows %username% variable(or similar) and making it a hidden text variable in StoryLine?
Here's the whole of it.
Our employees have individual domain user accounts. I'd like for them to be able to open a course that I host on our intranet, have the course pull the variable based on who's logged in vs user input. Then at the end, instead of prompting for a name with printing the results (report.html) have it use the username variable info.
In Studio '09 I'm using a custom report.html but it replies on the user putting their name in the field before printing. Not a big deal. Functional. But it'd be nicer to have it done automatically since the info is available through the OS variables.
3 Replies
Javascript is run through a client and should not be able to access the OS. I think this would be exploitable so would be blocked.
May want to ping Steve Flowers to confirm.
It may be possible in IE if run locally but even then I think you would struggle to get this to work.
I had a random idea that may be a solution for this. Not sure.Haven't had the time to sit with it and work it out.
I'm hosting my courses on a SharePoint intranet site. Instead of being so wrapped around the OS variable it occurred to me that I may be able to use the SPUser class to get a user name based on the login.
You'd need some kind of intermediary to grab the username. JavaScript wouldn't be able to access that on its own. Your idea for Sharepoint is a good one.
I've plucked usernames from a portal that launched a Storyline file. As long as the place where the username appears is consistent, you shouldn't have trouble getting it with something like this:
This discussion is closed. You can start a new discussion or contact Articulate Support.