Pass variable value from story.html to storyline file


How can I pass a variable value from the story.html to the storyline file?

I have tried putting this function in the head of the story.html file ...

function story() {
var player = window.parent.GetPlayer();
var testvar= 1;

...and putting an onload="story()" in the body, but thats not working, any ideas?


1 Reply
Gary Keogh

OK so i figured out how to do this thanks to Niels van Drimmelen

I added the following javascript to an 'Execute Javascript' Trigger when the first slide timeline starts.

var head = document.getElementsByTagName('head')[0];
var script = document.createElement('script');
script.src = 'story_content/spl.js';
script.type = 'text/javascript';

Then placed the file spl.js into the published "story_content" folder with the following JavaScript:

var SP_Assess_Included = 0;
var player = GetPlayer();

Then i was able to alter the value of SP_Assess_Included after the lesson was published and the value could then be passed into the STORYLINE file at runtime, and most importantly altered without having to republish the storyline file.