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

77
Vistas
Javascript Function For Clipboard copy not working

I am pretty new at coding in Javascript. I am trying to Copy my url through the action of button click which will fire the function below CopyTextFunction(). But I am not being able to find out why it is not working since alert(copyText); in my function shows that the text was copied.

function CopyTextFunction() {
                const params = new URLSearchParams(window.location.search);
                params.get('ID')
                var copyText = "http://randomsite.com/OnlineShop/ShopProducts?ID=" + params.get('ID');
                //alert(copyText);
                alert(copyText);
                navigator.clipboard
                  .writeText(copyText)
                  .then(() => {
                      alert("successfully copied");
                  })
                  .catch(() => {
                      alert("something went wrong");
                  });
            }
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

May you should check Browser compatibility for clipboard.writeText. I mean... writing permissions for Clipboard depends on browser versions and contexts. Please, have a look to * marks in the link:

https://developer.mozilla.org/en-US/docs/Web/API/Clipboard_API#browser_compatibility

about 4 years ago · Juan Pablo Isaza Denunciar
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