Passing Values from HTML to Storyline

1 min read

In the previous few post we discussed about moving information from Storyline to HTML/ PHP etc.

1. Storyline to PHP via FLASH

2. Storyline to PHP via JavaScript

3. Storyline to PHP via AJAX

One may notice that in all these cases, the data flows one way, i.e., you can pass the information from Storyline to HTML or PHP, but not vice-versa.

Let us discuss the same today:

Recently I made a course where I pushed the value from HTML (that was embedded in the Storyline) to pass values to Storyline player.


Click on the picture to view the demo

For this –

Step 1: I put the following code in the Javascript section of HTML <head>(in a function).

function story() {
var player = window.parent.GetPlayer();
var pass = 1;
player.SetVar("pass",pass);
   }

Step 2: Call the function in the body of the HTML. For example on clicking a button–

  

This will push the value into a Storyline variable called ‘pass’ when a button is clicked.

Step 3: Upload the HTML and related files to server. (I haven’t yet tried including web object from local system)

Step 4: Now I create a variable in Storyline named “pass”.

Step 5: Add the webpage as a web object in Storyline.

And you are done! Publish and upload the output to the server.

This method has opened a box of opportunities.

For example – I can now save player scores in a CSV. Later I can pull the data from the CSV and create leader board.

How would you use this method?

5 thoughts on “Passing Values from HTML to Storyline”

  1. Hi, how can I pass values to storyline? For example, I want to pass the username to storyline when users learn the course.

  2. Gregory Viljoen

    Hi,

    This works fantastically thank you very much.
    I do have a slight problem though. When I try to open the HTML5 story output in chrome browser it does not work.
    Does anyonehave an idea why it works in Firefox but does not work in Chrome?

    Thank again.

    1. Hi Greg,

      Chrome updates regularly and quite frequently. As a result, some of the older Storyline outputs fail to render correctly.
      In such cases, I look if there is any recent update in my Storyline version. In most cases, Articulate releases the patch pretty soon.
      Once updated my new published output renders fine.

      let me know if I can help you.

      Cheers!

Leave a Reply