JavaScript trigger not triggering in 2.5. Works in 2.4.
Jun 01, 2015
We are creating Web based versions of some courses. Within this course, on the entry of the last slide, we are inserting a javascript snippet. With Storyline 2.4, this code is called and reaches back to our application. With Storyline 2.5, this code is not called. I verified this via Chrome's Inspect Element.
I've tested 20 courses. 9 published with 2.4 (worked) and 11 published with 2.5 (didn't work). We'd like our team of 5 to all use 2.5 and need to figure out what the difference is between 2.4 and 2.5 so the courses can be published in 2.5 and our code gets called.
Has anybody else experienced this issue?
27 Replies
Hi Morgan,
I haven't heard of a particular issue with Update 5 and Javascript triggers - but have you tested in different browsers and on a different hosting server to start? You could use one of the options mentioned in this article.
I've only tried using Chrome. I'll try with Firefox and Safari today.
The projects are served off of S3, so I don't think that should be a problem.
I just checked and I get the same results in Firefox 37 and Safari 8. I'm using Chrome 43. I passed along my .story files to Articulate support but they also recommended reaching out on the forums. Hoping to get some help here as well.
Hi Morgan,
I see that Renato is still working with you on your files, to compare a version published with Update 4 vs. Update 5 to see where it stops working, so I'll continue to follow along in this as well.
Just an update:
Articulate has identified this as a bug and has passed it on to their QA team.
Thanks Morgan for coming back here to provide an update.
Hello,
We're experiencing the same issues outlined in https://community.articulate.com/discussions/articulate-storyline/html5-output-compatibility-with-google-chrome-44 and plan on updating to 2.6. Does 2.6 happen to include a fix for this?
Hi Morgan,
That link did not bring me to an active thread - but yes, Update 6 of Storyline 2 deals with the issues of content not being displayed while viewing in Chrome Version 44 and using HTML5. You can read about that here and for previously published courses, a few additional fixes while our team works on an updater.
I'm asking if 2.6 includes a fix for this particular thread, "JavaScript trigger not triggering in 2.5. Works in 2.4."
Sorry for my confusion Morgan - you referenced the other thread so I wasn't sure. Update 6 was an emergency type of patch based on the Chrome/HTML5 issue so no it doesn't include that fix. You can always see what elements were included in an Update by reading the release notes here. Also when you have an open case with our Support team we'll send you an update via email about any updates which resolve the issue and we'll post in the appropriate forum threads as well.
Thanks for reaching out and let us know if you need anything else.
Hello Ashley,
I'm looking through https://www.articulate.com/support/storyline-2/issues-addressed-in-the-latest-articulate-storyline-2-update/ and it seems like this issue wasn't fixed in 2.7 either. Can you confirm? If it wasn't fixed in 2.7, where is this issue on your roadmap?
Thanks,
Morgan
Hi Morgan,
Thanks for checking in here. Did you receive the email that John Say sent on October? I've copied it below:
I am writing to update you on the status of your previous report about javascript not working in Storyline. We were previously unable to reproduce the issue on our end. We do not support troubleshooting javascript code. Today, using Articulate Storyline 2 update 7, I edited your course to add a simple javascript popup to the last slide in order to test if simple javascript codes can work within the slide. I uploaded the published course to our server. You can access the course here:
[link removed]
The javascript pop-up does appear on the last slide, suggesting that javascript does work on the published course. Can you please try to install the latest version of Articulate Storyline 2 and see if the javascript will work on your end?
Please make sure that you have the latest version of Articulate Storyline 2 installed which is Storyline 2 update 7. In Articulate Storyline, go to Help > About Articulate Storyline.
As John mentioned we can't support Javascript code, but it seems that code in general is working in Storyline 2 update 7 - so you'll want to look at using the latest update. I do see that the issue is still with our team but I'm unable to offer a time frame in regards to a fix or status update for the issue so I'd look at using Storyline 2 Update 7 going forward and if you'd like share the Javascript code in the forums so that others in the community can take a look.
We'll upgrade to 2.7, publish a course and test. Thanks!
Sounds good Morgan - and if you didn't get the email above, I can have it resent to you - just let me know!
With 2.7, we tried to load the JS upon opening the last slide of the course but it still didn't fire off. Here is the JS:
function ExecuteScript(strId)
{
switch (strId)
{
case "6AB7HXMAODd":
Script1();
break;
}
}
function Script1()
{
parent.postMessage('Course Completed', 'http://localhost:5000');
parent.postMessage('Course Completed', 'https://epic.myteachstone.com');
parent.postMessage('Course Completed', 'https://epic2.myteachstone.com');
parent.postMessage('Course Completed', 'https://qat.myteachstone.com');
parent.postMessage('Course Completed', 'https://int.myteachstone.com');
parent.postMessage('Course Completed', 'https://www.myteachstone.com');
parent.postMessage('Course Completed', 'https://myteachstone.com');
parent.postMessage('Course Completed', 'https://agility.myteachstone.com');
parent.postMessage('Course Completed', 'https://prod.myteachstone.com');
}
So it seems this still only works in 2.4. Is there anything you can do to help us out? We'd really like to move to 2.7. Is there a workaround or anything you can suggest?
Hi, Morgan -- Many thanks for the update, and as Ashley had indicated, we are unable to provide support for JavaScript coding. Luckily, we have lots of community members who are more than willing to share their expertise, so we will need to defer to them to assist you further with specifics.
And for those who'd like to review it, here is a sheet on JavaScript Best Practices that it never hurts to keep handy. :)
Hi Morgan Walker,
Do you have any patch file for running this code. For example if you get tincan statement in your course you must include the tincan.js or tincan.min.js file to your story.html file like..
<script SRC="story_content/user.js" TYPE="text/javascript"></script>
<script src="story_content/story.js" type="text/javascript"></script>
<script src="tincan-min.js"></script>
so if you you have this kind of files you must want to include your output.
Thanks for responding, Prakash! What I pasted above is the contents of our user.js file. story.html has:
<script SRC="story_content/user.js" TYPE="text/javascript"></script>
<script src="story_content/story.js" type="text/javascript"></script>
but my story_html5.html file doesn't have that. Do you think it would be worth adding it there?
Hi Morgan,
There is no need to add these lines, i am just saying to you want to add your link blow the two lines. But if you have patch file you must insert inside the <head> tag or <body>tag in your story_html5.html.
Sorry, I'm confused. My "link", e.g. the script that I care about running is in user.js. That file is already called from story.html. I'm also not sure what a patch file is. I'm going to add
<script SRC="story_content/user.js" TYPE="text/javascript"></script>
Into story_html5.html and see if this works.
Inserting
<script SRC="story_content/user.js" TYPE="text/javascript"></script>
directly under
<script src="mobile/player_compiled.js" type="text/javascript"></script>
and the JS fired off. My next question, do I need to take this manual step for each web course I publish?
Hi morgan,
I aslo have a problem with my js not firing, but this is for a normal web publish. Where do I add the
<script SRC="story_content/user.js" TYPE="text/javascript"></script>
???
Directly under:
<script src="mobile/player_compiled.js" type="text/javascript"></script>
in story_content/user.js
Hi Morgan,
I don't have the line
<script src="mobile/player_compiled.js" type="text/javascript"></script
in my user.js file, fine attached the screenshot of the user.js file
My apologies. You should be adding it in story_html5.html
This discussion is closed. You can start a new discussion or contact Articulate Support.