Forum Discussion

BrettSchlagel-e's avatar
BrettSchlagel-e
Community Member
11 years ago

Copy Text Variable to Clipboard

I need some help. 

I need users to be able to click a button to copy a text variable to their clipboard, which can then be pasted in a word doc. This doesn't necessarily have to be done through a text variable, but is the only way I've come to think this will work.

In the past I used a text entry field that when published allows users to copy and paste the text by highlighting and right clicking as you normally would. I've been asked to eliminate that route and only use a one-click copy to clipboard button.

I was able to get this to work using JavaScript, however, this only worked in IE and I desperately need it to work in FireFox. I used the method below from another post to get it to work in IE:

Copy to Clipboard JS

I've sifted through post after post and haven't found anything that will work for this situation. If at all possible, this would be great if this worked with HTML5 as well.

Any help would be greatly appreciated. Thanks!

26 Replies

  • martinyeaman's avatar
    martinyeaman
    Community Member

    Hi, I'm trying to insert a storyline scene into rise 360. It uses a data text insert to allow readers to takes notes as they go through sections of a course. I would like them to simply click a "copy to clipboard" button to have the notes in the data text box. When i insert this into Rise it comes up with "null" Images attached below.
    Is it not possible to do this within Rise?

    • BeccaLevan's avatar
      BeccaLevan
      Community Member

      Welcome to E-Learning Heroes, Martin!

      While your question is a better fit for our community JavaScript experts, I thought I'd share Zsolt's post in hopes it might help you out!

      • martinyeaman's avatar
        martinyeaman
        Community Member

        Thanks Becca, I'm after code that copies the users input into the clipboard. 

        I have created a simple scene with just a Data Input Text Box and a button in Storyline. The object trigger is the button which executes JS to copy their text input into clipboard.

        "Button 1

        Execute Javascript

         When the user clicks button 1"

        This is published to Review 360 and hosted in a Rise course.