SCORM Compaliant LMS's Javascript API

We have been building a SCORM compliant LMS, and have been facing a cross-origin problem.

The Scenario is, our LMS is built with ReactJs for the client-side on " Domain A " along with asp dot net core web API as a server-side on " Domain B ". The SCORM content lies on the server-side of course.

When I try to run a SCORM course in an iframe (ex: <iframe src="Domain_B\path_to_scorm_index"></iframe> ) in my SCORM player component, I get this error Uncaught DOMException: Blocked a frame with origin "Domain B" from accessing a cross-origin frame. at findAPI ... .

It happens when the SCORM APIWrapper.js tries to access the parent window to find the API provided by scormAPI.js.

I tried to put the scormAPI.js on the server-side and run the course in a new separate window like <script src="Domain_B\scormAPI.js"></script><iframe src="Domain_B\path_to_scorm_index"></iframe> , but still get the same error.

Has anyone run into the same problem before and managed to solve it?

Or can anyone give me a hint on how to get through this problem?


Hey @Melad-Hanna did you manage to solve this

Hi @oma0256, I managed to solve this by using the same domain for both front-end and Back-end API. So, when the APIWrapper.js in the Scorm package tries to find the API provided by scormAPI.js, it doesn’t throw cross-origin error any more because they are both on the same origin (domain).