HOW TO: Use Javascript to create custom print results page in Storyline 2

A colleague of mine asked the question recently about how to show allow the user to print the results of Essay questions.

While I know you can use the built-in "Print Results," since that isn't supported in HTML5, I have been working on an alternative using Javascript.

Here's the Javascript code I used and a quick mockup/proof of concept.  

var player = GetPlayer();

var newWindow = window.open("", "_blank");

newWindow.document.write("<button onclick='window.print();'>Print Results</button>");

newWindow.document.write("<h1>Response 1</h1><p>"+player.GetVar("Essay1")+"</p>");

newWindow.document.write("<h1>Response 2</h1><p>"+player.GetVar("Essay2")+"</p>");

newWindow.document.write("<h1>Response 3</h1><p>"+player.GetVar("Essay3")+"</p>");

newWindow.document.title = "Results";

2 Replies