0

I am trying to show xApi AU (assignable unit) content using HTML iFrame in our portal (custom LMS - Learning Management System). HTML Iframe would pass LRS (Learning Record Store) parameters like below to launch AU which is working.

<URL to AU> ?endpoint=<URL to LMS Listener> &fetch=<Fetch URL for the Authorization Token> &actor=<Actor> &registration=<Registration ID> &activityId=<AU activity ID>

I am trying to figure out how to know that user has finished viewing content (preferably using JavaScript) so parent page knows user has finished AU and can be redirected back to List page. I would like list page to show Completed status for that viewed contents.

In the past (SCORM days), we have added button on top of iframed content "I have completed, Take me back" or similar but users just click that and mark content completed without actually completing.

Is querying LRS constantly the only option possibly?

Thanks

SamJackSon
  • 1,071
  • 14
  • 19

2 Answers2

2

From an xAPI standards perspective, you're correct that for an arbitrary AU/piece of course content, there's no built-in mechanism for to intercept the traffic between the user's browser and the LRS, so there's no direct way to identify if a "completion" statement has been sent. There's a couple common solutions to this problem:

  1. Make an LRS proxy that sits between the user and the actual LRS, intercepts the statements watching for completions and then passes them on to the actual LRS. This is how the cmi5 test suite (Catapult) works. You can have this thing also have a websocket that your parent iframe keeps open and receives messages when these completions come through.

  2. Poll the LRS frequently for the type of statement you're looking for.

  3. If you've constrained your configuration to only specific browsers you can strongly control, you can require the users to install browser extensions that can listen to all network traffic and potentially do updates within the scope of the other frame (or combine with the other techniques above).

  • Thanks @George. As our portal environment does not allow to create API with name (it adds prefix to endpoint), we may have to go with the option of periodic polling unfortunately. – SamJackSon Oct 31 '22 at 12:54
  • 1
    This looks like cmi5, so I'll add to what George included that you could trigger an update on use of the `returnURL` which content is required to use (whether it will is anyone's guess). – Brian J. Miller Oct 31 '22 at 15:33
-1

You're not going to get an informative answer based on your generic question that is clearly tied to some random Learning Management System that you are using. Be specific and you'll get better help.

Never the less. Let's start with some basics to give you a few hints. TLAs... they get you no-where as context matters.

I'm 95% sure that an iFrame cannot communicate with it's parent in any meaningful way. That being said, this then basically brings you into the world of APIs and Webhook technologies. i.e. iFrame sending message to API back end server, which then sends message via Webhook to parent page.

Based on what you've said so far, it sounds like you've got your basic system architecture wrong and you're trying to force a square peg through a round hole.

P.S. TLA = Three Letter Acronym. Try not to use them so people understand what you are talking about. I can already think of multiple TLAs that you have mentioned that mean different things in my head than what they do in your head.

Edit. One option worth looking at Allowing a child Iframe to call a function on its parent window from a different domain

Michael Cropper
  • 872
  • 1
  • 10
  • 28