gabrieldoty / simplify-scorm

Scorm 1.2 Javascript API
MIT License
230 stars 77 forks source link

window.open(scormUrl) #39

Open Tyre88 opened 3 years ago

Tyre88 commented 3 years ago

All SCORM reporting works fine when i just do location.href = scormUrl; But when i use window.open(scormUrl) the reporting doesn't work. It is fetching the last data from the backend but it seems like something goes wrong when i do "loadFromJSON(response)" and the SCORM api doesn't get initialized.

Have anyone else experienced this issue and if so, did you solve it?

dipakdas99 commented 3 years ago

Hi @Tyre88, What is the scorm URL? Could you please guide me on that? I am assuming you've uploaded an uncompressed zip file in the s3/cloud storage bucket is that right? Thanks in advance!

Tyre88 commented 3 years ago

Hi @dipakdas99 I've solved the problem by proxying the SCORM course through ocelot gateway and as soon as there's no CORS everything works fine.

dipakdas99 commented 3 years ago

I didn't quite understand. Actually, I am pretty new to SCORM. Could you please tell me the workflow?

Tyre88 commented 3 years ago

I created a upload function where i "injected" the simplify-scorm js into the index.html in the scorm education and then injected a wrapper ontop of the simplify-scorm to call my server to take care of the logging of the status from the SCORM, all worked fine untill i wanted to open in a new window instead of the same window (it had CORS all the time) so i am not quite sure what was the problem.

The main problem seemd to be that the SCORM.initialize didn't run and therefore no data was logged.

dipakdas99 commented 3 years ago

Thanks for sharing this!

`

STAART

<iframe src="" style="border:0px #ffffff none;" id="iframescorm" name="myiFrame" scrolling="no" frameborder="1" marginheight="0px" marginwidth="0px" height="650px" width="100%" type="text/html" allowfullscreen="allowfullscreen" webkitallowfullscreen="webkitallowfullscreen" mozallowfullscreen="mozallowfullscreen"></iframe>

<script src="../../Downloads/scormAPI.js"></script>

<script>
var scorm = {};
scorm.url = '/Users/dasdipak99/Desktop/synapse-scorm.zip';
scorm.student_id = '123';
scorm.student_name = 'Dipak';

scorm.start = () => {
    window.API.cmi.core.student_id = scorm.student_id;
    window.API.apiLogLevel = 4;
    document.getElementById("iframescorm").setAttribute("src", scorm.url);
}
</script>`

I used the above to run scorm on the browser. Copied code from @fabmesto's question( https://github.com/gabrieldoty/simplify-scorm/issues/40 ) for POC. Am I doing anything wrong here?

vivaneo commented 6 months ago

Good morning,

I tried the different code examples to inject a scorm .zip file but it doesn't work.

The file downloads instead of starting playback.

Do you have sample code ready to work?