Using the clipboard API from a Google Apps Script Web Application

688 views Asked by At

I have a simple Web-application (written in Google Apps Script using the HtmlService) When a user clicks a button, it used to "paste" whatever text is on the clipboard to an input field. That worked fine until some Chrome-version (I guess it was version 83)

    $(".readclipboard").on('click',async function(){
      const text = await navigator.clipboard.readText();
      console.log("clipboard read!");
      $("#boeknummer").val(text);
     });

When I check the console after clicking the button, I get this error:

Uncaught (in promise) DOMException: Disabled in this document by Feature Policy.

Some research got me to this page: https://developers.google.com/web/updates/2018/06/feature-policy#using

However, I can't figure out how I can set a "HTTP header" on Google Apps Script HTMLService. It also seems like I can't set an "allow" attribute on the iFrame... Anyone?

0

There are 0 answers