"Copy to clipboard" functionality inside of a custom app - Freshdesk

Hello all!
:point_right: I’m developing a custom app for a freshdesk client. It contains buttons whose role is to copy some link in the clipboard. However, as apps in freshdesk ticket view are displayed inside an iframe html tag, I got an error saying that I cannot use clipboard write inside an iframe that does not have allow="clipboard-read; clipboard-write" as parameters. The issue is I can only modify the custom app. I cannot add parameter to the external iframe, which is part of the freshdesk admin code I don’t have access to.

:bulb: 2. An example of the code about this functionality :

<button class="btn btn-success" onclick="navigator.clipboard.writeText('https://backoffice-qualif.onestock-retail.com/c340/fulfilment/order/${numeroCommande}-1')
.then(() => {
  // Success!
.catch(err => {
  console.log('Something went wrong', err);
">Ship from store (SFS)</button>

:camera_flash: Screenshot of the error I get :


Good Day!
Welcome to the community!
We are not allowing the mentioned sandbox settings ( allow="clipboard-read; clipboard-write) due to some security concern

Hope it helps :slight_smile:


1 Like

@Andonirina I see to understand what you are trying to achieve. But would you help me understand the business use case behind it? That can help us to conclude the most favorable use of the app platform or APIs for you. At the moment, what @Santhosh shared is true.

1 Like

Hello! Thank you for your replies. I understand the issue with information security.
@Saif Here is the business use case behind this need : our client uses some other web app, especially for managing their product stock. One of them is onestock-retail.com. Each freshdesk ticket has a custom field with an order id which they need to check up in Onestock app, based on the order id, which I take from the ticket properties, append to an url and them redirect them into the right url. However, onestock is blocking redirection from another website so I was thinking about copying the needed url to the clipboard so that the agent can go to a new tab and just paste the link

This is a very legit case. I would like to revisit the security aspects and discuss how we can allow developers to do this securely.

For now the easiest approach seems to be is to show an URL and allow users manually copy paste

1 Like

Yes indeed. Thanks for your help

1 Like