Forum Discussion
MarineLancelin
4 months agoCommunity Member
Get variables from iframe in Javascript
Hi!
I created a custom variable "isStorylineCompleted" in Storyline that is set to "true" when the last slide is viewed. And in my parent window, I would like to show a button if the last slide i...
Jürgen_Schoene_
4 months agoCommunity Member
if the LMS and the course in the iFrame are in the same domain*, it's easy
javascript trigger in Storyline
const player = GetPlayer();
const completed = player.GetVar("isStorylineCompleted");
if(parent && parent.setCourseState){
parent.setCourseState( completed );
}
javascript in the outer html
<script>
function setCourseState( inState ){
alert( "course state: " + inState );
}
</script>
* if not use postMessage