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.
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!
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.
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.
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
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...
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.
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.
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.
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.
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 ;-)
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.
Yes it is related to the Javascript in the MasterSlide. I copied it and checked it to see if i could quickly find what was wrong with it, but its quite elusively coded. What i see is, its a script from cluelabs.com to customize the player.
Checking the player only thing it does ( as i can quickly see ) is changing the player's background color and the UI-icons color. For that you donot need to use cluelabs scripts. That can be done in the existing CSS of Articulate. Lets see if i can quickly find a workaround so you can abandon the cluelabs script.
If for some reason you need to stick to the cluelabs script... they should fix it then ;-)
Thank you. Thought as much. Just using cluelabs as it created the script for me. If you’re looking at a workaround, i’ve always wished that script would include a visited state for menu items. Cluelabs said they couldn’t help when i asked. Only if it’s easy of course. You’ve already helped so much and we wouldn’t want your wife getting the wrong idea!😉🤣
Not quite clear what you mean with the visited state...but its possible for sure. If you use the css as attached above... you can remove the javascript of Cluelabs. Your title will have the correct background color in the player. Glad to help anytime... my wife understands ;-)
You'll notice in the triggers I've played with a few being triggered on the click of the send email button but the others are still just set by being selected or not - it works for them all either way I do it, except for number 5 and the free text.
28 Replies
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.
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!
I know this thread is old, but Javascript seems to no longer work in review 360. Anyone else have that issue?
No. Javascript does work properly in Review and in Storyline360. Share your .story because the mistake is in the code somewhere.
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.
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
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
Gonna do some tests and check seeing if i can figure out whats happening for both of you... Sharon and Katherine..
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.
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.
This post was removed by the author
This post was removed by the author
I think you meant Katherine.
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.
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 ;-)
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!
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
Yes it is related to the Javascript in the MasterSlide. I copied it and checked it to see if i could quickly find what was wrong with it, but its quite elusively coded. What i see is, its a script from cluelabs.com to customize the player.
Checking the player only thing it does ( as i can quickly see ) is changing the player's background color and the UI-icons color. For that you donot need to use cluelabs scripts. That can be done in the existing CSS of Articulate.
Lets see if i can quickly find a workaround so you can abandon the cluelabs script.
If for some reason you need to stick to the cluelabs script... they should fix it then ;-)
If you replace your generated CSS file with this one after publishing. Then your player is as you made it with cluelabs script.
Thank you. Thought as much. Just using cluelabs as it created the script for me. If you’re looking at a workaround, i’ve always wished that script would include a visited state for menu items. Cluelabs said they couldn’t help when i asked. Only if it’s easy of course. You’ve already helped so much and we wouldn’t want your wife getting the wrong idea!😉🤣
Get Outlook for iOS
Not quite clear what you mean with the visited state...but its possible for sure. If you use the css as attached above... you can remove the javascript of Cluelabs. Your title will have the correct background color in the player. Glad to help anytime... my wife understands ;-)
Thanks
Hi again Math,
The java script you helped me with has been working so well. But something weird is happening now and I just cant work it out.
For some reason the variable for the free text (Textentrycommit12)
And the variable for Textentrycommit5 keep showing up as "null" in the email
I've mucked around for ages trying different things to solve it but can't seem to.
Would you have time to take a look at it for me?
https://360.articulate.com/review/content/59ebd0c6-d6aa-4058-821d-9618085b6908/review
You'll notice in the triggers I've played with a few being triggered on the click of the send email button but the others are still just set by being selected or not - it works for them all either way I do it, except for number 5 and the free text.
Thanks in advance!