gotoPageInHistory()

Help for using specific functions

gotoPageInHistory()

Postby Andy » Thu Feb 13, 2020 1:43 pm

I have what I hope is a quick question on this one. Is the PowerPac page history array saved to LMS? I found to my dismay that the ToolBook equivalent does not seem to do so, so the reader can get stuck on a help page. I could handle this manually but if the PowerPac has already solved it then I have my solution.
Thanks, Andy
Andy
 
Posts: 47
Joined: Tue Sep 09, 2014 3:40 pm

Re: gotoPageInHistory()

Postby Clifton » Thu Feb 13, 2020 2:46 pm

The PowerPac does not save its page history to the LMS.
However, there are a couple things you could try:
  1. Create a browser session cookie and save window.pageHistory to the cookie. Then when the book is restarted, the course should just check for the presence of the pageHistory session cookie and if found, copy it back to overwrite window.pageHistory.
    If you wanted to save this to the LMS, the you would have to JSON.stringify(window.pageHistory) for the LMS to accept the information. When the pageHistory is handed back to the course on next launch, then the client would have to JSON.parse(window.pageHistory) and copy it to window.pageHistory in order for the course to make use of the information by using gotoPageInHistory().
    While all of this seems a bit involved, it would quite intriguing and useful to get it working.
  2. A simpler approach would be to mark help pages as skipNavigation = true. If the LMS drops the student onto a help page, then the on load page code could navigate them back to a navigable page.
Clifton
Site Admin
 
Posts: 732
Joined: Tue Jan 14, 2014 1:04 am

Re: gotoPageInHistory()

Postby Andy » Fri Feb 14, 2020 12:00 pm

Thanks, Clifton. I'll probably just save the return page name in a global that is saved. That way if the SCO exits cleanly enough to remember the current page it will also have the return page. (Next I'll take a look at tying to save state periodically so it will handle non-graceful exits. :idea: )
Andy
 
Posts: 47
Joined: Tue Sep 09, 2014 3:40 pm


Return to Function Help

Who is online

Users browsing this forum: No registered users and 1 guest

cron