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

126
Views
I'm trying to parse all the urls of the tabs I have open

I'm trying to copy the url's of all the open tabs with javascript and then put the urls into a html textarea, however it's not working. This is my code.

            chrome.windows.getCurrent({"populate":true}, function(currentWindow) {
               var tabURLs = [];
               var tabs = currentWindow.tabs;
               for (var i=0; i<tabs.length; i++) {
                   tabURLs.push(tabs[i].url);
               }
               var textArea = document.getElementById("thing");
               var text = textArea.value;
               tabURLs.forEach(item => text += item);
            });
        };

Keep in mind this is a google chrome extension, let me know how I can fix this!

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Your code is modifying a copy of the element's value, not the element itself.
You need to replace text += with textArea.value +=

P.S. The code can be shortened:

chrome.tabs.query({}, tabs => {
  document.getElementById("thing").value = tabs.map(t => t.url).join('\n');
});
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!