Skip to main content
pauldbabs
Inspiring
July 19, 2018
Question

Detecting in Javascript when activity is exited on Moodle

  • July 19, 2018
  • 8 replies
  • 913 views

I am developing content for an LMS (Moodle) using Captivate and Dreamweaver.
I am using Captivate to provide the wrapper with Scorm interfacing with the LMS.

Dreamweaver is used to create a web object coded with Javascript (a lot). The object opens in a window.

It's all working to plan with the exception that when activity is exited in the Moodle window, the object window remains open and the object Javascript no longer functions as intended.

The issue is that my web object Javascript isn't informed by Moodle that the activity has ended.

Is there an event that I can pickup via the Captivate/Rustici Scorm Driver that I can use to trigger the closing of my web object window/tab??

I'm having difficulty finding anything suitable.

This topic is closed to new replies. Start a new post to keep the conversation going.

8 replies

OH_CP_Lover_&_Hacker
Inspiring
July 21, 2018

I've some experience publishing Captivate projects as SCORM 1.2. that are used on Blackboard LMS.  Our college's academic LMS is Blackboard..and our HR's LMS is Corner Stone.

When the SCO (or project is done and ready to be closed down) I'll use GetControlWindow().Control.TriggerReturnToLMS() to close and return user back to the LMS window where they came from.  So far this, method has worked extremely well!  Just note, depending on how you configured your SCORM Player Behavior (Launch Behavior) settings when you add your packaged project to Moodle, you might have to address the command path differently as it may exist in a different Window layer/frame set.

pauldbabs
pauldbabsAuthor
Inspiring
July 23, 2018

What is the JavaScript event that indicates the activity has been terminated by the user/trainee?

I couldn't find it in the Captivate API or the Rustici scorm driver.

TLCMediaDesign
Inspiring
July 20, 2018

How is that web object opened?

If it is opened from the Captivate page, you should be able to add an event listener through the window.opener object.

pauldbabs
pauldbabsAuthor
Inspiring
July 23, 2018

I am checking to see if the Scorm Driver exists, this tells me if the App is embedded in Captivate or not (the app can work without Captuivate). Just before the weekend I realised there may be a part of the code that tries to fetch data off the LMS without making the check.

So I think that by adding something like:

if (typeof window.opener.GetDataChunk === 'function')
{

}

I can avoid the problem.

GetDataChunk is an API function in the Rustici scorm driver.

TLCMediaDesign
Inspiring
July 24, 2018

What do you mean by embedded? if it's truly embedded you could just check to see if there is a window.parent.

If you want to know if it running in a SCORM environment, check to see if the API is there.

I tested code if Captivate is opening your app, that has a listener to check if the window.opener is unloading and it works just fine.

OH_CP_Lover_&_Hacker
Inspiring
July 19, 2018

Are you working in SCORM 1.2, 2004, or ??

pauldbabs
pauldbabsAuthor
Inspiring
July 23, 2018

currently 1.2 but that is likely to change to xAPI/Tin Can in the not to distant future.