• Register
Welcome to the in5 Answer Exchange! This a place to get answers about in5 (InDesign to HTML5) and make requests.
0 votes
I need the viewer to be able to click on a button which automatically copies the button name to their clipboard.

The button in question is actually a part number. There will be more than one button (part number) on the page and the viewer will click the one they want and then goto another website where they can then paste the automatically copied text into a search field.

I assume this can be done via the Buttons and Forms menu and selecting the URL option and typing javascript:?????  in the field. I guess I then need something in the Javascript resources In5 export window, but what these are and how they look is beyond me. If you can help it would be fantastic.
asked in how_to by (150 points)
    

1 Answer

0 votes
 
Best answer

There are multiple ways to implement this. Here is one...

Attach the clipboard-polyfill.js file in the Resources section of the in5 export dialog.

Add a Go To URL Action with the following (URL) text:

javascript:clipboard.writeText("text%20to%20copy");

(Note the use of %20 for spaces. Upon testing this customization, I noticed that spaces were being removed.)

answered by (179k points)
selected by