Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

243
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda