goodbye.html file with Javascript is crashing Storyline

May 21, 2021

I am trying to add Javascript to the goodbye.html file.

If I add something like this, everything works fine when I publish:

<script>
alert('hello');
</script>

However, once I add any code that includes squiggly brackets (which nearly all Javascript does), Storyline crashes when I publish. For example, this simple code crashes Storyline:

<script>
function LMSHello() { alert('hello'); }
LMSHello();
</script>

In looking at the original file, I see it appears to use some sort of hot-variable system with squiggly lines. For example, I see this code of HTML in the original file:


<p role="alert" style="color: #333333;font-family: {0};font-size: medium;text-align: center;"><br><br><br><br>{1}</p>

Notice the {0} and {1}. This leads me to believe that Storyline is trying to parse the squiggly lines in Javascript, so when it sees this { alert('hello'); } it tries to parse it during publishing, fails, and crashes.

So my question is, how can Javascript be added to this file, or is there some way to - for example - enter <script>{2}</script>, and then somewhere in Storyline define what {2} should be so I can put my Javascript there?

Thanks.

 

 

 

1 Reply