Detecting if Scorm launched from Moodle Mobile

Detecting if Scorm launched from Moodle Mobile

by James Roberts -
Number of replies: 4

Within Javascript, is there a simple, easy way to detect if a student has launched a Scorm package from within the Mobile Moodle app as opposed to a launch from within regular Moodle with browser/desktop? I tried doing this by detecting an iframe but it doesn't work. I also considered detecting the browser but in fact apparently the app uses the default browser of the device.

While I generally dislike customizing for devices/platforms, one reason for doing this is that desktop Moodle requires users to "Exit activity" whereas Mobile Moodle asks users to tap "< Back". This different terminology leads to confusion and I would prefer to tailor instructions.

BTW, thanks for all the work to integrate Scorm into Moodle Mobile. My Scorms work flawlessly and they look really good on tablets.

Average of ratings: -
In reply to James Roberts

Re: Detecting if Scorm launched from Moodle Mobile

by Juan Leyva -
Picture of Core developers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

Hi James,

I suppose there will be multiple ways to detect it, but I think that the more accurate one would be check the location.href (you will see that scorms in the mobile app are open using a local file protocol).

Juan

In reply to Juan Leyva

Re: Detecting if Scorm launched from Moodle Mobile

by James Roberts -

Juan,

Thanks! You solved my problem, and I also learned about a new property:  location.href.

Nevertheless, I think it's a kludge, lousy solution. "location.href" returns one string in Android and another in iOS. (I tried this on an Android tablet and learned that the Moodle app launches in Google from the sd card.) From a browser/website/desktop, location.href seems to return the http of the website. (This is problematic because a Scorm package can be launched from many websites.)

I want a simple way (a boolean) to know whether a Scorm package is launched in Moodle Mobile, or in desktop Moodle. For example, I was hoping that a Moodle table carried this critical information that a doLMSGetValue could tell me  about.

In reply to James Roberts

Re: Detecting if Scorm launched from Moodle Mobile

by Juan Leyva -
Picture of Core developers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

HI James,

we think that the location.href workaround is enought, we see a little bit overkilling modifying the SCORM schema adding new possible values just for this.

Juan

Average of ratings: Useful (1)
In reply to Juan Leyva

Re: Detecting if Scorm launched from Moodle Mobile

by James Roberts -

Juan,

I was simply looking/hoping for an existing variable in an existing Moodle table that would indicate if a user/student accessed Moodle through Mobile Moodle or PC Moodle.

I was NOT asking for a new Moodle table, with a new Moodle variable.

You guys have done yeoman service making Scorms/quizzes functional on tablets/phones. Thanks again! Among the various problems to make Scorm packages/Quizzes functional on mobile apps, you can ignore my query.

But in, uh, 2018 or so, we'll revisit this issue.