My Javascript in Storyline 2 works locally but not online
Dec 07, 2017
I've got a short piece of Javascript in a proof of concept module that works when I publish it to my PC and run story_html5.html but doesn't work when I upload it to the web.
It tests the user input for the first part of a URL by stripping out all but the first 24 characters, putting that in a variable 'newsub' and then triggering on the value of 'newsub'. Newsub has a default value of 'wasthisbeforeentry' to check whether it's being changed.
The code is
var player =GetPlayer();
var a = player.GetVar("TextEntry1");
var a = a.slice(0,24)
player.SetVar("newsub",a)
There's a test version at https://lighttouchlearning.com/test/story_html5.html
If you want to test it the 'correct' string is https://normanlamont.com
Screen 2 displays both TextEntry1 and newsub. It shows that newsub isn't getting changed as in the last line of Javascript. Yet this same module works perfectly in the published version my local PC.
I've tried different browsers, it's the same in them all. Can anyone advise me on where I'm going wrong? (This is Storyline 2)
2 Replies
Seems to work fine for me in FireFox. Maybe you are running a cached version. Clear your browser, or run it in an incognito window.
You're right - I did clear browsing data with no success, but the incognito window worked. I should have thought of that. Thanks for taking the trouble.
This discussion is closed. You can start a new discussion or contact Articulate Support.