Help with Controlling Starting Slide/Navigation with Javascript

Apr 03, 2014

We want to use a client side script, preferably javascript, to control the starting slide of the user (for Presenter 13).

Reason why: We'd like to store the last slide that the user visited before closing browser/tab -- so that we can save their slide # in a database. Then when the user logs in again, we'd like to be able to start the presentation from where the user had previously left-off.

Is this possible and if so, how would we do it?

16 Replies
Nathanael V

Hi Leslie,

Thanks for the welcome and for the heads-up about how to use the cookies function via settings. The "problem" with your offered solution is that it is browser and machine-specific. We're looking to track the user (with a database) so that if they close out their presentation on their work computer and then login later at home on their home computer, we'll be able to direct the user to the slide they left off on when at work.  For an example of what this would look like, think of how Netflix Streaming works. If you watch a show on your ipad and then stop midway through and then later on pick up your smart phone and return to that same show, you don't have to figure out where you left off -- the system does it for you.

Nelson Diaz

You can get the last slide viewed by the user from your LMS SCORM cmi.suspend_data.  Create a variable to get the LMS value of the suspend data as a string.  You can then create another variable to extract the last slide viewed from that string.  For example, let's suppose you named the variable that gets the LMS value "cmiString".  Since you're using Presenter '13 you could write something like:

var lastViewed = parseInt(cmiString.substr(cmiString.length-6,1),16)+1;

Ryan Walker

Hi Nelson,

I tried your code but it always returns "1" for my suspend_data.  We're using Articulate Storyline to author the SCO.  I attached an example of the suspend_data I'm seeing.  I'd love to be able to determine the last slide viewed for each user based on the suspend_data.

Thanks

 

Nelson Diaz

Ryan,

I don't use Storyline, so I don't know if the script below will work. Looking at your suspend_data example, it seems like Articulate uses some sort of modified base64 system to track the slides viewed.  Assuming this is the case, your example has slide 18 as the last slide viewed.  I'm not sure what happens after slide 18, with all the "default" references. It could mean that slide 18 includes a knowledge check, or an interaction with multiple tabs, or something like that.

Assuming you already have a variable "cmiString" that pulls the suspend_data as a string, add the following 3 variables to your script (lastViewed returns the last slide viewed, hopefully):

var b64index = {'0':1,'1':2,'2':3,'3':4,'4':5,'5':6,'6':7,'7':8,'8':9,'9':10,'a':11,'b':12,'c':13,'d':14,'e':15,'f':16,'g':17,'h':18,'i':19,'j':20,'k':21,'l':22,'m':23,'n':24,'o':25,'p':26,'q':27,'r':28,'s':29,'t':30,'u':31,'v':32,'w':33,'x':34,'y':35,'z':36,'A':37,'B':38,'C':39,'D':40,'E':41,'F':42,'G':43,'H':44,'I':45,'J':46,'K':47,'L':48,'M':49,'N':50,'O':51,'P':52,'Q':53,'R':54,'S':55,'T':56,'U':57,'V':58,'W':59,'X':60,'Y':61,'Z':62,'_':63,'$':64};
 var toStr = cmiString.match(/130+[0-9a-zA-Z_$]+13/).toString(); 
 var lastViewed = b64index[toStr.substr(-3,1)]+Number(((toStr.substr(-4,1))-1)*64);

Ryan Walker

Nelson,

Many thanks for your efforts, though the match function is returning null in this case.

I don't quite know why articulate's staff don't want to help with this.  Their developers know the answer to this question, or they couldn't have written the software.  Obviously articulate's software is able to read the string.  That's why the string exists, after all. 

I suppose I'll post to the other forum, as Ashley has suggested, though this seems like an inefficient way to proceed.  I assume it's more efficient for Ashley to contact the developer than it is for me to post to a forum and hope a developer stops by.

Ryan Walker

Hi Ashley,

At issue is not whether the string is human readable, but whether it is readable at all.  No developer would ever assign a human being to read the string as part of the functioning of a web app.  As for whether the string is readable... clearly it is.  Your software is able to read it.  That in turn means that you've had one or more developers in your employ who know how to read the string with machine code.  If that developer or developers is still in your employ, then they know the answer to my question.  Then it's just a matter of whether Articulate prefers to share the information with customers or not.

Deb Munitz

Since Articulate has deemed this proprietary what is the suggestion mechanism to have a customer support person rebuild the suspend data in the event of a corruption so that a user at slide 80 of a restricted navigation lesson of 100 screens doesn't have to start over at the beginning.

This is an issue that happens too often on Studio 9.

Ashley Terwilliger-Pollard

Hi Deb,

This thread is a bit older, so you may want to reach out to Ryan or others using the "contact me" button on their profile to see if they're able to share specifics of what they have set up to work with this behavior. It's not something our support team can assist with, but if you're able to determine a method that works for you and are able to share I'm certain others in the community may find value in that as well.

This discussion is closed. You can start a new discussion or contact Articulate Support.