JavaScript Character Limits

Feb 27, 2013

I am working in JavaScript to send variable results via email. I got to a point where my variables stopped appearing in my email. After hours of testing, I finally came to the conclusion that Articulate Storyline seems to have a character limit for the JavaScript. Why is that or is there a way to override that with some sort of JavaScript character limit that can be entered? Any help you can offer would be great. This has been a very frustrating issue.

17 Replies
Joseph Fournier

Hi Jeremy, were you ever able to find a solution?

I encountered this limit as well. I hit a limit at 32,335 characters in an Execute JavaScript trigger. I tried pulling the data out into an external JavaScript file, but I think SL still imposes a limit--either that or I introduced a syntax error in the external file and never found it. I can only assume that the limit is imposed because of LMS datastores have a similar limit in the fields they use for resume data. 

For my particular application, I was able to reduce the size of the file below the character limit, but since I'm doing a full-on software simulation that generates datasets, I'm concerned that may encounter an overall limit later in the development. I'm hoping I can break the JavaScript up into separate files and that I don't encounter an overall limit. I'll be happy to keep you posted. 

Jeremy Larson

Hi Joesph,

No. I never did find a solution. I ended up needing to shorten the character limit of the JavaScript. This was actually my first time using JavaScript and I have not had to use it since. Unfortunately, I do not think I will be much of an assistance to you.

PS I also contemplated using multiple actions to break up the JavaScript. I didn't want the end product to get to complicated though and found a way to "short-hand" the characters in my script. I do think that this might be a solution, but have not tested it.

Joseph Fournier

Hi Jeremy and Emily. Thanks for your responses. I'm probably okay in terms of figuring this out. I'll just need to determine what the overall limit is and then I'll adapt according to that.

I'm using the JavaScript trigger partly as a datastore in order to generate millions of unique scenarios for the simulation. I just had to reduce it from billions to millions...but I think my learners will still get enough variety. ;-)

The other thing I'm going to be doing that will drive the size of the datastore is generating detailed scenarios...but I have backup plans if the data limit bites me.

Thanks!

Brian McSkane

Hi Mathew,

Thanks very much for your interest! OK, in the course I collect lots of feedback from the learner via sliders and text entry boxes. At the end I have javascript then to compile all of the feedback and export to an email (window.open(mailto_link, 'emailWin');).

The problem however is that when I execute the trigger, the email is generated but not all of the details are exported. As explained in this post, there seems to be a limit to the number of characters that can be exported and I seem to have hit it.

To get around it I created two sets of javascript and a trigger for each. I then split the output so email1 shows half of the export details and email2 shows the rest, i.e. both fall within the limits of the export allowance.

Two emails are not ideal but it does work. If you have a solution I'd love to hear from you!

Thanks, Brian

Walt Hamilton

It depends on what is imposing the limit. If as Joseph suggests, it is a field limit in the LMS, it seems unlikely there is anything you can do about it.

On the other hand, Matthew suggests that it might be a limit of how much SL can pass to the published output, and that you can change the .js file manually and avoid the limit, but frankly, he doesn't sound as if he has truly tested it.

Brian is no real help, because he had a different problem.

Jay is the one who asked the relevant question, and didn't get an answer. Even a hint here from tech support could save us a lot of experimenting.

You can look at the .js file yourself. In the published output, in the story_content folder it is named user.js. It is all one large file, with each separate trigger showing up as a function. You can change it however you want, but that's a tough way to go. Every time you publish, you have to go in and edit the .js file and that's not a good recipe for future success.

If Joseph is right, and it is a  limit in the LMS, we have to learn to live with it.

If Matthew is right, and each SL trigger is limited in how many characters it can pass, it should be easy enough to break your script into two parts. End the first part with passing your current data to SL , and use the change of one of those variables to trigger the execution of the second half.

Erwin Ancheta
Walt Hamilton

If Matthew is right, and each SL trigger is limited in how many characters it can pass, it should be easy enough to break your script into two parts. End the first part with passing your current data to SL , and use the change of one of those variables to trigger the execution of the second half.

I agree. I think I need to divide my codes in parts. That's another day of development. THanks Walt for your time. Appreciate it.

Regards,
Erwin

This discussion is closed. You can start a new discussion or contact Articulate Support.