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

76
Views
La función Javascript para la copia del portapapeles no funciona

Soy bastante nuevo en la codificación en Javascript. Estoy tratando de Copiar mi url a través de la acción de hacer clic en el botón que activará la función debajo CopyTextFunction() . Pero no puedo averiguar por qué no funciona desde alert(copyText); en mi función muestra que el texto fue copiado.

 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 answers
Answer question

0

Debería verificar la compatibilidad del navegador para clipboard.writeText . Quiero decir... los permisos de escritura para el Portapapeles dependen de las versiones y contextos del navegador. Por favor, eche un vistazo a las marcas * en el enlace:

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

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