SL3 - have print button on 1 slide but JavaScript not launching printer ?

I have a Certificate with a print button only on that slide. 

To print, the User will click the Print Certificate button I've inserted and on which I've assigned a Trigger with the following copied/pasted JavaScript:

if (document.location.href.indexOf(‘html5’) < 0) {

GetPlayer().printSlide()

} else {

if(!window.hasPrintStyle){

window.hasPrintStyle = true;

varcss = ‘@media print {body * {visibility: hidden;}#slidecontainer, #slidecontainer * {visibility: visible;}#slidecontainer {position: absolute;left: 0;top: 0; }#slideframe {overflow: visible;}}’,

head = document.head || document.getElementsByTagName(‘head’)[0],

style = document.createElement(‘style’);

style.type = ‘text/css’;

if (style.styleSheet){

style.styleSheet.cssText = css;

} else {

style.appendChild(document.createTextNode(css));

}

head.appendChild(style);

}

varwhereNow = $(“#slidecontainer”).offset();

$(“#slidecontainer”).offset({top:0,left:0});

window.print();

$(“#slidecontainer”).offset(whereNow);

}

When I've published and previewed this slide on SCORM, nothing happens when I click Print Certificate.

What am I doing wrong, please?

7 Replies