Any recommendation for implmenting SCORM wrapper in a frame-based HTML course

770 views
Skip to first unread message

Pontus Lundin

unread,
Jul 1, 2013, 10:56:21 AM7/1/13
to elearning-technolo...@googlegroups.com
Hi all,

Been trying the Pipwerks js SCORM wrapper (many thanks for the great work with it!). It works great with all editions and version i have tried. But my problem is when trying to retro-fit a non SCORM iframe base HTML course with making basic scorm setter and getters like status, and location/suspend_data (actually a JSON obj/string).

I have an index.html page that is getting launched in the LMS. From that page i have a iframe which includes the course. The index.html has all the SCORM methods and all hrefs has target=_parent meaning so any user navigation happens in the iframe.
If i would like to communicate with the LMS upon some events, like passed tests, i need to call the top frame and its method from a child iframe. So far so good. BUT the problem:

1) top.methodxx is not going to be top when launch in a LMS which use its own iframe(s) when embedding the course and i have no clue where the actual path is going to be (om all LMS). One can assume i could switch and not going from top but doing something like parent.methodxx but the course seems to build up various framesets and iframes making even that path invalid!!

Would it be possible to embeed the index.html iframe into all pages in the course? Would that keep the connection persistent or would scorm.init be needed on every page thus making several db requests ?

hHe root couse of this problem is ofcourse that i am unable to understand why the iframe path changes. It works partially, going forward in the course but once going back to the overview page and into a new lesson a new framesets seems to have been build upon what was aleady there so the parent ref get more like parent.parent or any other path.

Any ideas? kinda of hard to explain without any examples i know.

Thanks.


Philip Hutchison

unread,
Jul 1, 2013, 12:37:11 PM7/1/13
to elearning-technolo...@googlegroups.com
scorm.init (aka API.Initialize) can only be invoked once per course launch. Invoking it a second time will throw an error. 

If the child frame is nested on level deep, just use parent.

parent.methodxx();




--
You received this message because you are subscribed to the Google Groups "eLearning Technology and Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elearning-technology-and...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Pontus Lundin

unread,
Jul 1, 2013, 12:54:54 PM7/1/13
to elearning-technolo...@googlegroups.com
Hi Philip!

Thanks for your answer and the wrapper (lifesaver so many times ;)). I have tried the parent.method but it only works in some scenarios and this is rather strange, it seems like the course is adding new framesets making the level getting deeper and deeper atleast different from time to time...i think this is really my problem..i need to understand what location.href is being replaced etc.

So one workaround was to test if the method is available like so;

if(typeof(parent.setScormValue)==="undefined"){nope...try parent.parent} etc but it also fails.

Eventually i think i will need to come upp with a javascript snippet that loops through all named frames, like find every frame from top.document named frame['topframe'].

Another solution i am testing now is to replace all anchor targets with =my_top_frame_name_with_all_scorm_methods.

I have look into postmessage aswell, and it works too, but requires a path to window as well...

Thank you!

To unsubscribe from this group and stop receiving emails from it, send an email to elearning-technology-and-development+unsubscribe@googlegroups.com.

Pontus Lundin

unread,
Jul 1, 2013, 8:21:00 PM7/1/13
to elearning-technolo...@googlegroups.com
Now works, setting the location.src rather than href on some places made a different on how all the framesets was actually added or not to the DOM and now it always keep calling the method in the parent frame.

Questions:

1. Is iframe communication stable ? or should i go with postmessage ?

2 Also what do you recommend on the unloadHandler when closing the window, should i sett properties like completion status, scaled score value etc or is it safer to place such calls into actual runtime events during the course?

And finally

Assume i have 11 non-dependent- "free to select in any order" chapters. Upon completion it calls a method. But i dont like this bad way of storing data in JSON it looks non scalable ;) Also no easy way of setting scaled value other than check what current status is  increase the scaled score value.

Do you have any good hints/technics for this kind of problem ?

//Chapter1 done
case "GR":
coursebook
.GR="ok";
//Check if entire course is complete
 
if (coursebook.GR=="ok" && coursebook.SS=="ok" && coursebook.KK=="ok" && coursebook.OH=="ok" && coursebook.KF=="ok" && coursebook.EF=="ok" && coursebook.MI=="ok" && coursebook.SH=="ok" && coursebook.EL=="ok" && coursebook.BA=="ok"){
 
//All done sett course done
 coursebook
.done="ok";
 
}



Den måndagen den 1:e juli 2013 kl. 18:37:11 UTC+2 skrev Philip Hutchison:
To unsubscribe from this group and stop receiving emails from it, send an email to elearning-technology-and-development+unsubscribe@googlegroups.com.

Philip Hutchison

unread,
Jul 1, 2013, 8:54:15 PM7/1/13
to elearning-technolo...@googlegroups.com
1. iframe is the most stable method. it's cross-browser, has been around for years, and is evolving as part of HTML5. the only limitation is cross-domain security, which is where postMessage comes in. postMessage is not supported in older browsers, and requires parsing.  stick to iframe scripting -- if the iframes aren't working, it's likely a problem with your code, not with the technology/browser.


3. i'm pretty tired from a long day at work... i'm not sure i understand what you're asking. if you're just looking for a way to avoid having so many conditions in your conditional statement, try using a different approach, such as Array.every.




To unsubscribe from this group and stop receiving emails from it, send an email to elearning-technology-and...@googlegroups.com.

Pontus Lundin

unread,
Jul 2, 2013, 5:23:21 AM7/2/13
to elearning-technolo...@googlegroups.com
Thanks Philip and if you ever bring up that donate button on your page, please let me know!

Regards
Pontus 
Reply all
Reply to author
Forward
0 new messages