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

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

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 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!