JavaScript Issue - Local vs. Global Scope in user.js
Hello,
While Articulate is not able to provide Javascript support, I am hoping someone from these forums can help me.
At the end of my activity, I have a WebObject that embeds a local .html containing a button and some JavaScript code. The code is such that when the user clicks the button, Storyline variables are passed into the browser URL.
The variables that are to be passed are first set in some custom JavaScript within Storyline. (See left side of attached image)
However, once the course is published and the user.js is generated, my custom JavaScript is scoped locally to an automatically generated function called Script3. (See right side of attached image) Because it is scoped locally and not globally, this code is rendered inaccessible to my WebObject.
There is a fix that involves moving the Script3 end bracket up so that my getVariable functions are globally scoped.
This can get tedious during testing, so I am wondering if anyone might have a better fix. Is there any way to control how code is scoped when the user.js file is generated?
Thank you for any help!
-Josh