• Empleos
  • Sobre nosotros
  • profesionales
    • Inicio
    • Empleos
    • Cursos y retos
  • empresas
    • Inicio
    • Publicar vacante
    • Nuestro proceso
    • Precios
    • Evaluaciones
    • Nómina
    • Blog
    • Comercial
    • Calculadora de salario

0

536
Vistas
Unhandled Promise Rejection: NotAllowedError: The request is not allowed by the user agent or the platform in the current context

I'm trying to copy the results of a game to the clipboard upon completion of the game, but I'm receiving the following error when running in Safari: "Unhandled Promise Rejection: NotAllowedError: The request is not allowed by the user agent or the platform in the current context, possibly because the user denied permission."

The following function is called when the game is finished, and the clipboard api is called towards the bottom. Every related question I've been able to find has had to do with playing audio, but I'm not sure what applies here. Thanks for any help!

function generateScoreCard () {
let result = ``;
result = result + "Circuit " + GetFormattedDate() + "\n\n";

for( var i=0; i< pastGuesses.length; i++ )
{
  console.log(pastGuesses[i].color)
  switch (pastGuesses[i].color) {
    case '#51ff45':
      result = result + '✅';
      break;
    case '#c1ff4d':
      result = result + '🟢';
      break;
    case '#fceb4c':
      result = result + '🟡';
      break;
    case '#ffa647':
      result = result + '🟠';
      break;
    case '#ff774a':
      result = result + '🟠';
      break;
    default:
      result = result + '🔴';
      break;
  }
}

var clip_result = result + " = " + numGuesses;
//await navigator.permissions.query({ name: 'clipboard-read' });
await navigator.clipboard.writeText(clip_result);

}

about 3 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 Nuestro proceso Comercial
Legal
Términos y condiciones Política de privacidad
© 2025 PeakU Inc. All Rights Reserved.

Andres GPT

Recomiéndame algunas ofertas
Necesito ayuda