Welcome Guest Search | Active Topics | Sign In | Register

Issue with accessing navigator.clipboard.readText() Options
John Dunn
Posted: Tuesday, September 21, 2021 4:56:36 PM
Rank: Newbie
Groups: Member

Joined: 9/21/2021
Posts: 4
I'm using v21.2.47.0 and am getting a 'DOMException: Read permission denied' exception when accessing navigator.clipboard.readText(). Even though the documentation says AllowJavaScriptAccessClipboard defaults to true I've also set that explicitly via SetOptions().

Here is the example HTML I am loading

Code: HTML/ASPX
<html>
  <button onclick="myFunction()">Click me</button>
  <script>
    async function myFunction()
    {
      txt =  await navigator.clipboard.readText();
      alert(txt);
    }
  </script> 
</html>
eo_support
Posted: Tuesday, September 21, 2021 6:13:08 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,072
Hi,

This permission is controlled by WebView.RequestPermissions event. You need to handle that event and call e.Allow() in your event handler. AllowJavaScriptAccessClipboard only controls the more "traditional" way of accessing clipboard by calling document.execCommand("copy").

Thanks!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.