Javascript functions between canvas, iframe and HTML page

304 Views Asked by At

I am currently working on a PlayCanvas project which is going to be embedded in an iFrame inside a slideshow(Articulate Storyline). The slideshow application lets me use Javascript by using:

player.SetVar("Result",score);

where player is:

parent.getPlayer();

The structure ends up being, each being a child of the former:

  • Main html file(slideshow)
  • iFrame (with source on the same domain)
  • Canvas
  • JS script inside PlayCanvas application

My main problem here is that I can't call getPlayer() without accessing the iFrame, but parent.document.getElementById('') returns null. I feel like I'm overlooking something very obvious but I can't get it working.

Thanks in advance, and if my formatting/question is incorrect please let me know so I can update the post!

1

There are 1 best solutions below

0
On

Well, found the issue, Articulate uses GetPlayer() instead of getPlayer(), cost me way too long to figure that out.