Jump to slide in Storyline from outside the course?

Using something like JavaScript, is there ANY way I can go to a specific slide or scene in a Storyline course, from outside the course?

Example: A learner is just working on a webpage at their job and it asks them:

"Hey, did you want to learn more on this function? Click here to be taken directly to the specific part of this bigger course that talks about what you're seeing here."

And then it jumps to, say, slide 23 in scene 5?

15 Replies
Brian Dennis

I believe there's javascript support inside SL to jump to a specific slide. Search these forums for a list of functions available.

Invoking code inside your SL project from outside is a whole different ballgame. For starters, you're likely to encounter a Cross Origin Access error, or null function exception. I suppose you could work up some web object approach, but that's far from certain to work. Keep in mind when SL's javascript functionality is available

Russell Killips
James Holt

I like it. 

You can replace all of the individual slide triggers with the following JavaScript.

var player = GetPlayer();
var nSceneNumb = player.GetVar("nScene");
var nSlideNumb = player.GetVar("nSlide");

//function get slide index
function getIndexOf(array,scn,sld) {
var length = array.length;
for (var i=0; i<length; i++) {
if (array[i].sceneIndex==scn & array[i].sceneSlideIndex==sld-1) {
return i;
}
}
return false;
}

//run function
var result_slideId = getIndexOf(story.allSlides,nSceneNumb, nSlideNumb);

//show slide index
player.showSlideIndex(result_slideId);

James Holt

Hi Russell,

Correct! The JavaScript works with HTML5 however, a good flash actions script 3 developer, should be able to connect the script and drop a small SWF on the first slide.

similar to Set/Get Articulate Storyline Variables within your AS3 Flash file. (elearningehnanced.com)

https://elearningenhanced.com/blog/2012/05/24/setget-articulate-storyline-variables-within-your-as3-flash-file

Russell Killips

Hello Matthew,

You could modify the Storyline HTML5 redirect script.  This script is in the story.html file.

For me it is on line 81. else if (g_bRedirectHTML5)

Here are my changes to the Redirect Script. The changes are in bold and are underlined.

else if (g_bRedirectHTML5)
{
      var strLocation = "story_html5.html";
 
      if (g_bTinCan)
      {
            strLocation += "?tincan=" + g_bTinCan + "&" + document.location.search.substr(1);
      }
      else if (g_bLMS)
      {
            strLocation += "?lms=1";
  
            if (g_bWarnOnCommitFail)
            {
                  strLocation += "&warncommit=1";
            }

            strLocation += "&" + document.location.search.substr(1);
      }
      else
      {
            strLocation += "?" + document.location.search.substr(1);
      }
 
      location.replace(strLocation); 
}

Christian Holger Pedersen

I was so happy to find out that this worked perfectly!

In Storyline 2 that was. But alas, the story.html file looks a lot different in Articulate 360. Any idea where (and what)  to put in the new story.html file?

 

Html5 still doesn't recognize the url's without some "extra guidance". Flash gets it, though. 

Example: 

http://elearning.kk.dk/tmf/borger/pafgiftertest/story_flash.html?scene=3&slide=1

vs:

http://elearning.kk.dk/tmf/borger/pafgiftertest/story_html5.html?scene=3&slide=1 

NB. Click "Nej" to the resume-box that pops up on revisiting.