Forum Discussion
Retrieve LMS User Name as Variable
Hi Angela -
Depends on how / where it's displayed. When the course launches, if the info is contained in the query string ?value=name, then it's pretty easy to grab.
If the info you want to grab appears in a parent window or frame consistently, it can be scraped with some creative javascript. Try this. You can retrieve your name from the title attribute of the user image in the upper right of the elearning heroes site by adding this to the developer's console:
console.log(document.getElementsByClassName("user__img")[0].getAttribute("title"));
Right-click the window and choose inspect (in Chrome) then click the console tab. Paste that line in there. The same concept applies to anything that appears in a page. You can scrape that data from a displayed page easily. Same concept applies to pages that aren't displayed. You can grab stuff from a page return and chisel little bits of data if the page address is reliable and the "address" of the information within the DOM is predictable.
Anything that appears in a page structure can be grabbed from Storyline as long as the user has access to the page.