Java to print and/or email works in some but not all courses

Hi,

I've a course which uses Java Script to allow the learner to either email or print the contents of a text variable (this code was very helpfully sourced from these forums, thank you). This code did work originally in this one particular course I've been working on but now doesn't and I'm struggling to work out why.

I've copied the  slide containing the java script into a new story and tested it through that and it works fine in that course. I've also taken the original course and removed 2 scenes to reduce the size of the course, and the Java Script works in that one too.

So basically I have 3 courses all containing the same slide, 2 of which work and the 3rd which doesn't. Can anyone suggest what might be the issue here? Could it be anything to do with the size? The offending course is just over 42Mb once published. The version of the course which works but has had 2 scenes removed is 29 Mb. Might just be a red herring but I'm grasping at straws now.

Any help very gratefully received.
Many thanks

9 Replies
Matthew Bibby

No, the size of the project doesn't have anything to do with it Anne.

I just tested your course here and the email functionality worked.

How are you testing the course? Keep in mind that the JavaScript won't run when you preview the course, you'll need to either upload it to your LMS/server or test the HTML5 output locally.

Hope that helps!

Anne Prophet

Thanks for this Matthew, I appreciate you taking the time to test it and reply. :)

I've uploaded all three courses containing the slide to our LMS so in theory they should all be working from the same starting point. I guess I must have something within the course which is stopping the java, I just need to work out what it is.

Thanks again.

Matthew Bibby

It's hard to say without seeing the full course Anne, but I'd double check that you have the necessary variables set up in Storyline.

You could also try adding this JavaScript to the first slide of your course and set it to execute when the timeline starts:

alert("JavaScript is working!");

This will tell you if JavaScript is working in the course.

From there it will be a case of trial and error to figure out what is interfering with the code. I'm happy to take a look if you can share the course here (or you can email it to me if you prefer). 

Anne Prophet

Thanks Phil,

I've finally managed to resolve the issue after a prolonged process of elimination. Hooray!

The problem was caused not by this bit of Java code but in fact by another bit of Java on another slide further on in the course which contained a parameter that was missing the "". The lesson here for me is that if you have Java in a course that is not coded correctly, it appears to prevent all Java from working throughout the entire course. Not being familiar with Java Script and also not having used Java in Storyline, I didn't expect that to be the case.

On the subject of the limit to the number of characters, do you mean there is a limit to the size of the data you can email from within the course? I did see that there is a limit to the number of characters of code that you can have, so assumed I was OK as I took the number of characters in the variable names to be what was counted and not the number of characters within the contents of the variable. Have I misunderstood this?

Thank you Matthew, Phil and Ashley for your replies, they are all greatly appreciated.

 

Ashley Terwilliger-Pollard

Happy to hear that Anne and glad you were able to figure it out! 

I'll defer to Phil for the character limit, as I don't know about Javascript, but my guess is the "mailto:" set up is limited on number of characters based on a standard email address field/line? Total shot in the dark guess. :-)