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

259
Visualizações
How to search through an html file from an external link using JavaScript?

I'm very new to Javascript and coding in general and have a project I would really like to work on, but am having trouble knowing where to start, in particular step one. So far this is what I want the programme to do:

  1. Access/read html files from four external links (Is this where I use fetch()? Are there any packages you can recommend for this?)

  2. User inputs a list of names

  3. Search html files for each item in list

4a. If there is a match, then output 'match' and which file the match was found

4b. If no match then output 'no match'

Is it more complex than just using HTML, CSS and JavaScript?

Thank you in advance!

about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

You won't be able to get data from external url in browser due to CORS policy

What you should do instead is create server-side solution and API for it.

Server side solution should request the external page HTML code, search for the word and send the result back to the browser.

about 4 years ago · Juan Pablo Isaza Relatório

0

The problem with implementing this in the browser is because of cross-origin issues. Essentially you aren't allowed to fetch() nor XMLHttpRequest() to other domains unless they specifically let you to. See the mdn docs here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS

You could implement this is Node.js which allows you to run js in a desktop environment. If you were doing so, i recommend the following:

  • use node-fetch to do HTTP requests
  • use cheerio to parse the data

Best Regards, Kelvin

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