Can’t read clipboard in Telegram WebApp: Permissions policy blocking Clipboard API

I’m developing a web application inside Telegram’s WebApp (Mini App), and I’m trying to read or write text to the clipboard using the Clipboard API. However, when I try to execute navigator.clipboard.writeText() or navigator.clipboard.readText(), I receive the following error:

NotAllowedError: Failed to execute 'writeText' on 'Clipboard': The Clipboard API has been blocked because of a permissions policy applied to the current document.

Is here another way to read content from clipboard?

  1. Checked for Clipboard API availability:
    I verified that navigator.clipboard is available in the environment. The Clipboard API exists, so it should theoretically work.

  2. Triggered clipboard operations through user interaction:
    To meet security requirements, I made sure that both clipboard read and write operations were triggered via a user action, such as clicking a button. Here’s an example of the code I used:

  3. Tried both reading and writing text:
    I tried both navigator.clipboard.writeText() for writing to the clipboard and navigator.clipboard.readText() for reading from the clipboard. Both operations throw a NotAllowedError with a message saying the clipboard has been blocked due to a permissions policy.

  4. Tested in different environments:

In Chrome: The clipboard functionality works as expected in a standard Chrome browser (both desktop and mobile). I can successfully read and write to the clipboard after user interaction.

In Telegram WebApp: The same code throws the NotAllowedError when run inside Telegram’s WebApp (Mini App). This suggests the WebView in Telegram is applying stricter security policies or permissions that block access to the Clipboard API.