• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Detecting in Javascript when activity is exited on Moodle

Explorer ,
Jul 19, 2018 Jul 19, 2018

Copy link to clipboard

Copied

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.

Views

575

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Jul 19, 2018 Jul 19, 2018

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jul 23, 2018 Jul 23, 2018

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
People's Champ ,
Jul 20, 2018 Jul 20, 2018

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jul 23, 2018 Jul 23, 2018

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
People's Champ ,
Jul 24, 2018 Jul 24, 2018

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jul 24, 2018 Jul 24, 2018

Copy link to clipboard

Copied

LATEST

I meant dropped into Captivate as a web object.

I have my scorm driver detect code working now. Seems to work fine.

It is independent of how the web object/code is deployed. It doesn't matter if it starts in the parent window or in a new window or a tab.
The presence or not of the scorm driver determines the behaviour of my code. Whether it tries communicating with the LMS or not and whether it stays open or it closes. That's how I need it.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Jul 21, 2018 Jul 21, 2018

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jul 23, 2018 Jul 23, 2018

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Help resources