Javascript only working on start page

Jun 05, 2024

Hi Storyline-lovers,

I assigned the following Javascript-code t a button. It is working if I put the button on the start page of my project.

If I put it on another slide it is not working. I just copy the working button, and pasting it into another slide. And it is doing nothing. The browser console says:

bootstrapper.min.js:2 actionator::exeJavaScript - this.execUserJs is not a function
  (anonym) @
  (anonym) @
  h @
  exeJavaScript @
  v @
  p @
  u @
  s.trigger @
  triggerAction @
  _e @
  Pi @
  (anonym) @
  (anonym) @
  (anonym) @
  _e @
  (anonym) @
  applyMethod @
  executeAction @
  executeActions @
  (anonym) @
  forEach @
  executeFilteredPlayerEvent @
  _e @
  e @
  triggerEvent @
  d @




JS-CODE:
function kopiereTextInZwischenablage() {
    var manuellEingefuegterText = "Workplace / Laptop"; // Hier den gewünschten Text eingeben

    var textBereich = document.createElement("textarea");
    textBereich.value = manuellEingefuegterText;

    document.body.appendChild(textBereich);

    textBereich.select();
    textBereich.setSelectionRange(0, 99999); // Für mobile Geräte

    try {
        var copySuccessful = document.execCommand("copy");

        alert("Text wurde in die Zwischenablage kopiert: \n\n" + manuellEingefuegterText);
    } catch (err) {
        console.error("Kopieren in die Zwischenablage fehlgeschlagen", err);
    }

    document.body.removeChild(textBereich);
}

kopiereTextInZwischenablage();

Anybody has an idea?

Thorsten

1 Reply