Communication between SL and web object producing cross-origin error on LMS

Jul 30, 2018

I have communication consistently working between my web objects and SL and it works in all environments including our LMS, Cornerstone. I am triggering slides to move forward etc... using:

function goSlide() {
var player = parent.GetPlayer();
player.SetVar("moveForward", 'yes');
}

For some reason I had better results using string variables. 

From Storyline to HTML I am using:

window.frames[0].frameElement.contentWindow.doThis();

This also works great until it is on our LMS. It creates a cross-origin error. I have seen that people are using post.message to get past this. Does anyone here have any experience with this? Or can point me in the right direction. THANKS!

 

 

 

 

1 Reply
Curtis Wiens

Figured this out using an example from pdf certificate thread. This works great for hand coded HTML5. Trying to get it to work now with Adobe Animate files. The structure is different.

// Name of the certificate html file
var certFilename = 'index.html';

// HTMLCollection of elements of type iFrame
var iframeElements = document.getElementsByTagName("iframe");

// Iterate over the iFrameElements HTMLCollection
for(var i = 0; i < iframeElements.length; i++){
/* If src of current iFrame element equals the filename set in variable
** certFilename call the generatePDF() function.
*/
var src = iframeElements[i].getAttribute('src');
if (src.indexOf(certFilename) !=-1) {
iframeElements[i].contentWindow.function();
}
}

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