Forum Discussion
Storyline 360 Review Feature supports Javascript?
Hi all
I am new to the whole review feature in Storyline 360, and what I really want to know is - will it support Java Script?
I need to add a volume/audio bespoke feature which uses Java Script - will this feature work in the Review when i send it out to the clients?
So far it doesn't seem to be but I wondering if I did something wrong with my Javascript
Cheers
28 Replies
- JennyCarlosCommunity Member
Hi Lizzie,
I found this article which may help address your concern:
Storyline 360: JavaScript Best Practices and Examples
cheers,
JC
Hi Lizzie,
It should work in Review for you, but if it's not you may want to start by sharing the Javascript code here with the community so that they could look at it and spot anything off.
- LizzieAngellCommunity Member
Hi so Javascript does work in preview. :)
I had code that worked in Storyline 2, but would not work in Storyline 360.
Hi Lizzie,
I'm not a Javascript pro by any means - but there are some of the Javascript variables to report things to you rLMS that may not work in Storyline 360 based on the way we changed our publishing engines.
The best option to figure that out is share here with the community and someone can hopefuly take a look for you!
- SharonGozaCommunity Member
I know this thread is old, but Javascript seems to no longer work in review 360. Anyone else have that issue?
- MathNotermans-9Community Member
No. Javascript does work properly in Review and in Storyline360. Share your .story because the mistake is in the code somewhere.
- SharonGozaCommunity Member
I'm having issues uploading, but here's the Review link. You'll notice the volume and mute doesn't work.
https://360.articulate.com/review/content/bb514dce-5b5c-48bb-91c4-f1793e6b8362/review
It does in a web browser.
- SharonGozaCommunity Member
Well, it doesn't work in Review, but it does work in any browser, so I'm not thinking it's the Javascript. I'm using a slightly older version of Storyline 360 because there is an issue with JAWS, but it's not that old.
https://360.articulate.com/review/content/bb514dce-5b5c-48bb-91c4-f1793e6b8362/review
- MathNotermans-9Community Member
Hi Sharon, Javascript does work in Review. So that is not causing it for sure.
If you check your console when working in Review or the browser you will get messages of whats going wrong ( in the browser and in Review ). Messages in red are errors...so they shouldnot happen and thus something is wrong in the file. Either code not correct or finding something not properly.
In the image above you can see 2 messages that cause issues in the browser. Videoplayer::play() failed. Thats the default behaviour nowadays. The reason why Articulate introduced the big black play button. However the red error below is coming from 1 of the files in Articulate... and thus is not good. This is an error in Articulate code. It shouldnot give an error message, just because you want to play a video without interaction.
But as you can see in the black lines of text...Storyline360 Default ProgramFiles generic_functions.js
vol: 0.5
Those are console.log("some message"); calls in Javascript. Javascript does work in Review and in the browser.
Nevertheless its a bug. When you do the same testrun in Review...there are a lot of more red error messages. Those should not be there. Up to Articulate to fix those. But those are not causing your Storyline not to work.
I added a console.log line into your code...
console.log("allAudios.length: "+allAudios.length);
because i suspect the file cannot find your audios. And indeed when running this in Chrome i get the amount of audios "2" but when running this in Review i get "0".
So somehow Review doesnot have access to your audios. It might be caused by the fact they are on layers... that im not sure of. But as your code cannot see the audios, well...it fails.
To show you audio and Javascript publishes well on Review... here is a sample of that...
https://360.articulate.com/review/content/98c4c2b9-ae4e-42fd-9bbd-855ece6f3f33/review
However the mass of red error messages related to fast.wistia and more i get too in projects... those are Articulate related and should be fixed by them.- SharonGozaCommunity Member
Thanks for debugging. I'm just going to deal with my scripts not working in Review since they work in browsers. Otherwise, I have to change a lot of pages and it's not worth it.
- KatherineWil623Community Member
Hi, I'm having same issue - java script suddenly not working in review (haven't published to test as scorm file yet - but I need it to work in Review)
I use latest version of Storyline360 and Chrome as browser. Have also tested in Microsoft Edge.My modern player was changing colour perfectly according to java script shown below. Very chuffed with myself.
I got creative and wanted to add an 'send self an email' into the mix and have the body of the email populate with the variables they had chosen. It was fantastic and working when I tested one variable so I went on to add them all in.
On next publish both sets of java script simply do not work.
I contacted our IT division to see if it was something in the security settings controlled by the organisation and they said no and that they're not able to help with java script programming.
Help! Anyone!
Here's the script that changed the player:
if(void 0===window.stencil360player){window.stencil360player=!0;var player=GetPlayer(),xhttp=new XMLHttpRequest,targlink="https://cluelabs.com/stencil/display/widget-slplayer-display?v=1614909087&chart=NTc5fDE3ODd8MjYzODljMWIzNjliYzVjNDFjNzk5NzM2Y2UzODMwMjE";xhttp.onreadystatechange=function(){if(4==this.readyState&&200==this.status&&""!=this.responseText){var e=document.getElementsByTagName("head")[0],t=document.createElement("style");e.appendChild(t),t.appendChild(document.createTextNode(this.responseText)),player.SetVar("stencilrendered",parseInt(player.GetVar("stencilrendered"))+1)}},xhttp.open("GET",targlink,!0),xhttp.send()}
Here's the script that sent the email:
var player = GetPlayer();
var email=player.GetVar("email");
var subject="Leadership characteristics to work on";
var body_start=player.GetVar("TextEntryCommit1"%0D"TextEntryCommit2"%0D"TextEntryCommit3"%0D"TextEntryCommit4"%0D"TextEntryCommit5"%0D"TextEntryCommit6"%0D"TextEntryCommit7"%0D"TextEntryCommit8"%0D"TextEntryCommit9"%0D"TextEntryCommitten"%0D"TextEntryCommit11");
var mailto_link='mailto:'+email+'?subject='+subject+'&body='+escape(body_start);
win=window.open(mailto_link,'emailWin');I've attached the sample slide if anyone cares to have a look. Apologies for the crazy amount of variables.
The java script for the player is on the master slide
- MathNotermans-9Community Member
Hi Sharon,
Your code had quite some errors. Variables you can get only one at a time...and then some more mistakes in the javascript. Javascript does work properly in Review.
Check here... mail works as planned...
https://360.articulate.com/review/content/1dd5de5f-027c-4a76-b14f-d6b35f261d60/review
Adding the fixed Storyline.When working with Javascript. DO NOT USE Storyline as your javascript editor. Get a quality Javascript editor like Sublime Text or Brackets. The color coding in there helps to find errors quickly.
- SharonGozaCommunity Member
I think you meant Katherine.
- MathNotermans-9Community Member
Gonna do some tests and check seeing if i can figure out whats happening for both of you... Sharon and Katherine..
- MathNotermans-9Community Member
Yeah that second one was for Katherine ;-) Only have to watch out that i don't call my wife Katherine or Sharon, then im in trouble ;-)
- KatherineWil623Community Member
Math you are a godsend - thank you so much - as you can see I am not a java script writer in any way shape or form!
- KatherineWil623Community Member
Hi Math,
I've moved on from the java script problem thanks to you, and have found something happening that you may be able to help me understand if it's related to the java script or not.
I lightbox some slides in the full course and on publish to review, the lightboxed slides appear black
I published a sample version of just the relevant slides but removed the java script trigger on the master slide and on publish to review, the lightboxed slides work properly. When I added the java script back in, the problem recurred.
Here's the sample slides - could you tell me if the lightboxing problem could be related to the java script? IF so, are you able to point me in a direction to help fix this? - Oh just had an idea, I'll use a different masterslide - hand on will try - nup, didn't work.https://360.articulate.com/review/content/9f748796-2642-4c54-9036-430c0dc052b3/review