Separate JavaScript file (Need Help)

Ok, what I would like to do is the to add a separate JavaScript file in the story_cotent folder so that when a button is clicked in the course the JavaScript code is run and the variables are sent out to an external URL for tracking, using the post method, the code is below:

var p = GetPlayer();

var email = p.GetVar("email")

var firstname = p.GetVar("firstname")

var lastname = p.GetVar("lastname")

var country = p.GetVar("country")

var courseid = p.GetVar("courseid")

var division = p.GetVar("division")

var sHTML = "";

sHTML += "<form id='formScore' method='post' action=' URL GOES HERE>";

sHTML += "<input type='hidden' id='USER_EMAIL' name='USER_EMAIL' value= " + email + ">";

sHTML += "<input type='hidden' id='FIRST_NAME' name='FIRST_NAME' value= " + firstname + ">";

sHTML += "<input type='hidden' id='LAST_NAME' name='LAST_NAME' value= " + lastname + ">";

sHTML += "<input type='hidden' id='COUNTRY' name='COUNTRY' value= " + country + ">";

sHTML += "<input type='hidden' id='COURSE_ID' name='COURSE_ID' value= " + courseid + ">";

sHTML += "<input type='hidden' id='DIVISION' name='DIVISION' value= " + division + ">";

sHTML += "<br><input type='submit'><br>";

sHTML += "</form>";

document.getElementById("divEmail").innerHTML = sHTML;


I can see from the documentation of the Articulate site that I need to amend the story.html file code with the below:

<script LANGUAGE="JavaScript1.2" SRC="story_content/MyJavaScriptFunctions.js" TYPE="text/javascript"></script>

My question is how I trigger this to run from within the course, the instructions state:

‘Then simply call the appropriate functions in your Storyline triggers. Please note that this method is not officially supported by Articulate.’

I’m not sure how to do this part..

Please help

Thanks Stephen

3 Replies
Stephen Cope

Hi Phil,

I have got the external .js file run using a trigger in the project, it opens a new window and displays the variables that have been captured in the storyline project, however I have only managed to do this if I publish to CD.  I am not sure why it only works if I publish to CD and run the project as an application, do you have ideas?