Javascript stopped working overnight

Oct 16, 2023

Hello,

I have a javascript that is used to open a pre-populated email and it has been working fine for the last month. However, it is no longer working after the weekend. Whenever the code should execute, nothing happens, whereas previously an outlook email would appear.

Is the code wrong? Has one of the updates affected it?

Any ideas would be great.

 

Here is the code:

var player = GetPlayer();
var email = 'name@emailaddress.com';
var subject = 'Lesson Title';
var emailBody = 'Body of text in the email';
window.location.href='mailto:'+email+'?subject='+subject+'&body='+encodeURIComponent(emailBody);

8 Replies
Commercial Training

Hi Phil,

Thanks for the fast response.

I haven't added/changed any of the javascript. The course itself has tons of branch offs and the javascript is copied and pasted numerous times with the only amendment being the email recipient. However, this wasnt a problem previously, it all worked fine.

No rename to variables either. The trigger is set to execute the javascript when the timeline starts on the slide. Again, this was fine last week but nothing happens this week.

I checked my defualt mail settings and they are set to outlook, so not sure what else to check.

I have included pictures to help.

 

Commercial Training

Thank you, i tried your recommendation and then thought to try the code in a new stroyline to see if this was the issue. So i opened a new storyline, added a submit button on slide 1 and then copied and pasted the same trigger to execute the javascript when the slide begins, on slide 2.

It worked....So i take it the code is ok and the error seems to be the variables you mentioned before?

I'm a little confused i must admit, but at least it narrowed the problem!

Commercial Training

So i found my issue...and of course, it is a user issue!

I was using the same javascript for 126 slides and I found a rogue comma that i'd accidentally added to one of them when editing slides for someone! 

Thank you both for the replies, the part about javascript being compiled in one file was the key to me going down this route and finding the error.