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

167
Vistas
Copy response.text() from fetch api in Chrome DevTools to the clipboard

I've tried using JS's copy() and creating an element/populating it with the data/copying the result. I cannot figure out how to get the response.text() to the clipboard.

The actual fetch is an XHR but the below example should suffice:

fetch('/readme.txt')
    .then(response => response.text())
    .then(data => console.log(data));
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You need to get response text and then copy it to the clipboard using another function:

fetch('/readme.txt').then(
    response => response.text()
).then(
    text => {
        navigator.clipboard.writeText(text).then(
            () => console.log("Success!"),
            (err) => console.log("Error copying response text", err)
        )
    }
)

In old browsers navigator.clipboard can be unavailable, you can get more info about copying in this answer

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