cors - SCORM issues with packages that load content from an external domain on a popup window - Stack Overflow

I'm implementing SCORM playing functionality in a Next.js-based LMS. I have a functional player th

I'm implementing SCORM playing functionality in a Next.js-based LMS. I have a functional player that can load and play SCORM packages stored in an S3 bucket, accessed via a Next.js API route acting as a proxy. This setup works perfectly for self-contained SCORM packages: I provide the SCORM API to the global window, packages find it, and I can track/save progress.

However, I’m facing issues with SCORM packages from sources like cloud.scorm. These packages don’t contain the actual SCORM content but instead load it by:

  • Opening a popup window on another domain, or
  • Appending an iframe pointing to a different domain.

I'm particularly having issues with the popup. Since these packages attempt to access window.parent to locate the SCORM API but are on a different domain, the browser’s cross-origin restrictions block access, and I can't figure out how to bridge this communication.

Has anyone dealt with this kind of SCORM setup, where the package relies on a cross-origin popup or iframe? Any advice would be greatly appreciated!

I’ve not been able to come up with any solution so far.

I'm implementing SCORM playing functionality in a Next.js-based LMS. I have a functional player that can load and play SCORM packages stored in an S3 bucket, accessed via a Next.js API route acting as a proxy. This setup works perfectly for self-contained SCORM packages: I provide the SCORM API to the global window, packages find it, and I can track/save progress.

However, I’m facing issues with SCORM packages from sources like cloud.scorm. These packages don’t contain the actual SCORM content but instead load it by:

  • Opening a popup window on another domain, or
  • Appending an iframe pointing to a different domain.

I'm particularly having issues with the popup. Since these packages attempt to access window.parent to locate the SCORM API but are on a different domain, the browser’s cross-origin restrictions block access, and I can't figure out how to bridge this communication.

Has anyone dealt with this kind of SCORM setup, where the package relies on a cross-origin popup or iframe? Any advice would be greatly appreciated!

I’ve not been able to come up with any solution so far.

Share Improve this question edited Nov 22, 2024 at 12:05 Oxx asked Nov 18, 2024 at 21:19 OxxOxx 12 bronze badges
Add a comment  | 

2 Answers 2

Reset to default 1

SCORM Cloud was designed to provide its own SCORM tracking, enabling your (or any) website to host courses without setting up a SCORM RTE. If you want to use SCORM Cloud and your own RTE you'd probably need to do a SCORM Cloud integration, which is a custom Rustici integration, not part of the SCORM spec.

Regarding launching courses stored on other non-SCORM Cloud domains (e.g. example/mycourse), it sounds like you already have that sorted since your S3 bucket files work fine.

The courses on those domains have to be configured to allow communication with your LMS. This can be done in many ways, including setting up CORS rules on the remote server, or by using proxy files, a la Rustici Content Controller.

The way I used to do it was to create a SCORM package that contained just the imsmanifest and an index.html file. This file would have a snippet of JS that would load the remote content into an iframe, and would handle the SCORM RTE calls. I'd then use postMessage or similar tricks to enable cross-domain communication between the index.html and remote files.

The important thing to understand: In my setup, the remote files never directly interact with SCORM or the LMS, they only interact with the index.html file. All SCORM interactions are handled by the index.html file. So a course content file would have a trigger such as postMessage("bookmark","page2") and the index.html file would have JS that receives and converts to a SCORM call such as scorm.LMSSetValue("cmi.lesson_location", "page2)

It turned out to be some strange behavior caused by running on localhost. After uploading to the development server, everything worked

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745593850a4634988.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信