Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

249
Views
Blazor server, copy to clipboard is failing in Safari

I added some simple functionality to copy a link to the clipboard, it works fine in Edge and Chrome but is failing in Safari with the following error:

The request is not allowed by the user agent or the platform in the current context, possibly because the user denied permission.

I believe this is because Safari wants you to do it via the click event and Blazor is routing the request through it's interop layer.

Has anyone got this to work?

Sample code:

Razor:

<button title="Copy link to clipboard" @onclick="@(e=> CopyToClipboard("someText"))">Copy</button>

C#:

        private async Task CopyToClipboard(string textToCopy)
        {
            await JSRuntime.InvokeVoidAsync("navigator.clipboard.writeText", textToCopy);
        }

I had the javascript call in a separate javascript file, in a function, but was getting the same result.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!