Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

132
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda