How do you get a variable to change using a Javascript trigger in a web object?

I have a page in a course (we'll call it the container) that I want to place a web object. That web object will be a second course (we'll call that one contents) (it's on the same domain). I need to have the contents change a variable in the container. I know I'll need to use Javascript to do this but it will have to work in both the flash and HTML5 versions. Has anyone had any luck in getting something like this to work?


7 Replies
Alexandros Anoyatis

Hi Michael,

If I interpreted your question correctly, you need to add JS code to the contents file you are to reference in your webobject (i.e. the JS trigger inside Storyline may not be needed).

You should be able to do this using GetVar (optional), changing the value of the variable in contents, then finally registering the change using SetVar.

The key part for the above to work is to use parent.GetPlayer() instead of just var player = GetPlayer();

Hope this helps,

Michael Shannon

Thanks Alexandros and Christie. I was able to get it to work in the web version using 

var player=parent.GetPlayer();

But using the same course published to the LMS and tested the communication between the content and the container never happens. While the web object loads fine, the javascript isn't able to communicate with the parent. Any idea on why this will happen?