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

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

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 Report

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